mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-14 15:05:53 +08:00
Refactor. (#4612)
### What problem does this PR solve? ### Type of change - [x] Refactoring
This commit is contained in:
parent
55f2b7c4d5
commit
e14d6ae441
@ -50,12 +50,6 @@ class UserService(CommonService):
|
|||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@classmethod
|
|
||||||
@DB.connection_context()
|
|
||||||
def user_gateway(cls, tenant_id):
|
|
||||||
hashobj = hashlib.sha256(tenant_id.encode("utf-8"))
|
|
||||||
return int(hashobj.hexdigest(), 16)%len(MINIO)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@DB.connection_context()
|
@DB.connection_context()
|
||||||
def save(cls, **kwargs):
|
def save(cls, **kwargs):
|
||||||
@ -134,6 +128,12 @@ class TenantService(CommonService):
|
|||||||
if num == 0:
|
if num == 0:
|
||||||
raise LookupError("Tenant not found which is supposed to be there")
|
raise LookupError("Tenant not found which is supposed to be there")
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
@DB.connection_context()
|
||||||
|
def user_gateway(cls, tenant_id):
|
||||||
|
hashobj = hashlib.sha256(tenant_id.encode("utf-8"))
|
||||||
|
return int(hashobj.hexdigest(), 16)%len(MINIO)
|
||||||
|
|
||||||
|
|
||||||
class UserTenantService(CommonService):
|
class UserTenantService(CommonService):
|
||||||
model = UserTenant
|
model = UserTenant
|
||||||
|
Loading…
x
Reference in New Issue
Block a user