Skip to content

Commit

Permalink
refactor: 类型注解增加
Browse files Browse the repository at this point in the history
  • Loading branch information
neronkl committed Sep 6, 2023
1 parent b8b7c12 commit 5b7428c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/bk-user/bkuser/apis/web/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class CurrentUserTenantMixin:

request: Request

def get_current_tenant_id(self):
def get_current_tenant_id(self) -> str:
tenant_id = self.request.user.get_property("tenant_id")
if not tenant_id:
raise error_codes.GET_CURRENT_TENANT_FAILED
Expand Down
2 changes: 1 addition & 1 deletion src/bk-user/bkuser/apis/web/organization/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def get_serializer_context(self):
def get(self, request, *args, **kwargs):
queryset = self.get_tenants()
# 将当前租户置顶
current_tenant_id = self.get_current_tenant_id()
current_tenant_id: str = self.get_current_tenant_id()
# 通过比对租户id, 当等于当前登录用户的租户id,将其排序到查询集的顶部, 否则排序到查询集的底部
sorted_queryset = sorted(queryset, key=lambda t: t.id != current_tenant_id)

Expand Down

0 comments on commit 5b7428c

Please sign in to comment.