Kevin Hu commited on
Commit
6889379
·
1 Parent(s): a8c4af8

Refactor. (#4612)

Browse files

### What problem does this PR solve?

### Type of change

- [x] Refactoring

Files changed (1) hide show
  1. api/db/services/user_service.py +6 -6
api/db/services/user_service.py CHANGED
@@ -50,12 +50,6 @@ class UserService(CommonService):
50
  else:
51
  return None
52
 
53
- @classmethod
54
- @DB.connection_context()
55
- def user_gateway(cls, tenant_id):
56
- hashobj = hashlib.sha256(tenant_id.encode("utf-8"))
57
- return int(hashobj.hexdigest(), 16)%len(MINIO)
58
-
59
  @classmethod
60
  @DB.connection_context()
61
  def save(cls, **kwargs):
@@ -134,6 +128,12 @@ class TenantService(CommonService):
134
  if num == 0:
135
  raise LookupError("Tenant not found which is supposed to be there")
136
 
 
 
 
 
 
 
137
 
138
  class UserTenantService(CommonService):
139
  model = UserTenant
 
50
  else:
51
  return None
52
 
 
 
 
 
 
 
53
  @classmethod
54
  @DB.connection_context()
55
  def save(cls, **kwargs):
 
128
  if num == 0:
129
  raise LookupError("Tenant not found which is supposed to be there")
130
 
131
+ @classmethod
132
+ @DB.connection_context()
133
+ def user_gateway(cls, tenant_id):
134
+ hashobj = hashlib.sha256(tenant_id.encode("utf-8"))
135
+ return int(hashobj.hexdigest(), 16)%len(MINIO)
136
+
137
 
138
  class UserTenantService(CommonService):
139
  model = UserTenant