-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create 3 new apis to manage the connection between role and user
- `/roles/{role_id}/users` to get users by a specific role - `/roles/bind_users` to bind users to one or more than one roles - `/roles/unbind_users` to unbind users from one or more than one role
- Loading branch information
1 parent
4390c10
commit c6f01cd
Showing
5 changed files
with
262 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
WITH | ||
user_ids := <array<uuid>>$user_ids, | ||
role_ids := <array<uuid>>$role_ids | ||
SELECT ( | ||
UPDATE User FILTER .id in array_unpack(user_ids) | ||
SET { | ||
roles += ( | ||
SELECT Role | ||
FILTER .id IN array_unpack(role_ids) | ||
) | ||
} | ||
) { | ||
name, | ||
username, | ||
email, | ||
mobile, | ||
departments := ( | ||
SELECT .directly_organizations { id, code, name } | ||
), | ||
is_deleted, | ||
created_at, | ||
last_login_at | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
WITH | ||
user_ids := <array<uuid>>$user_ids, | ||
role_ids := <array<uuid>>$role_ids | ||
SELECT ( | ||
UPDATE User FILTER .id in array_unpack(user_ids) | ||
SET { | ||
roles -= ( | ||
SELECT Role | ||
FILTER .id IN array_unpack(role_ids) | ||
) | ||
} | ||
) { | ||
name, | ||
username, | ||
email, | ||
mobile, | ||
departments := ( | ||
SELECT .directly_organizations { id, code, name } | ||
), | ||
is_deleted, | ||
created_at, | ||
last_login_at | ||
}; |