Skip to content

Commit

Permalink
refactor(console): simplify SQL query
Browse files Browse the repository at this point in the history
  • Loading branch information
bouassaba committed Jan 23, 2025
1 parent 2ac6036 commit addf0a1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion console/api/database/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def fetch_groups(user_id: str, page=1, size=10) -> Tuple[Iterable[Dict], int]:
SELECT g.id as "group_id", g."name" as "group_name", g.create_time as "group_create_time",
g.update_time as "group_update_time", o.id as "org_id", o."name" as "org_name",
o.create_time as "org_create_time", o.update_time as "org_update_time",
up.permission AS "permission"
up.permission
FROM "group" g
JOIN organization o ON g.organization_id = o.id
LEFT JOIN userpermission up ON up.resource_id = g.id AND up.user_id = '{user_id}'
Expand Down
2 changes: 1 addition & 1 deletion console/api/database/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def fetch_workspaces(user_id: str, page=1, size=10) -> Tuple[Iterable[Dict], int
SELECT w.id, w.name, w.organization_id, o.name as "organization_name",
o.create_time as "organization_create_time", o.update_time as "organization_update_time",
w.storage_capacity, w.root_id, w.bucket, w.create_time, w.update_time,
up.permission AS "permission"
up.permission
FROM workspace w
JOIN organization o ON w.organization_id = o.id
LEFT JOIN userpermission up ON up.resource_id = w.id AND up.user_id = '{user_id}'
Expand Down

0 comments on commit addf0a1

Please sign in to comment.