Skip to content

Commit

Permalink
fix: add project permissions to sign in response gf-560 (#563)
Browse files Browse the repository at this point in the history
  • Loading branch information
perekotypole authored Sep 27, 2024
1 parent 324e69a commit 34b9245
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions apps/backend/src/modules/users/user.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,24 @@ class UserRepository implements Repository {
const query = this.userModel
.query()
.findOne({ email })
.withGraphFetched("groups.permissions")
.modifyGraph("user_groups.id", (builder) => {
builder.select("id", "name");
.whereNull("deletedAt")
.withGraphFetched(
"[groups.permissions, projectGroups.[permissions, projects]]",
)
.modifyGraph("groups", (builder) => {
builder.select("user_groups.id", "name");
})
.modifyGraph("groups.permissions", (builder) => {
builder.select("permissions.id", "name", "key");
})
.modifyGraph("projectGroups", (builder) => {
builder.select("project_groups.id", "name");
})
.modifyGraph("projectGroups.projects", (builder) => {
builder.select("projects.id");
})
.modifyGraph("projectGroups.permissions", (builder) => {
builder.select("project_permissions.id", "name", "key");
});

if (!hasDeleted) {
Expand Down

0 comments on commit 34b9245

Please sign in to comment.