Skip to content

Commit

Permalink
Paginate /users (#1043)
Browse files Browse the repository at this point in the history
* Wrap organization dropdown in label instead of span

* Verify user route permissions and update TODOs

* Smaller organizations query in root layout

* Compress loaded data for users page

* Allow user to be locked and unlocked

* Server-side search and pagination for users

* Move user minification to users/common
  • Loading branch information
FyreByrd authored Nov 18, 2024
1 parent dac0ce7 commit 45a94f5
Show file tree
Hide file tree
Showing 5 changed files with 350 additions and 200 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,26 @@ export const load: LayoutServerLoad = async (event) => {
},
include: { UserRoles: true, Organizations: true }
});
const organizations = user?.UserRoles.find((roleDef) => roleDef.RoleId === RoleId.SuperAdmin)
? await prisma.organizations.findMany({
include: {
Owner: true
}
})
: await prisma.organizations.findMany({
where: {
OrganizationMemberships: {
every: {
UserId: userId
const organizations = await prisma.organizations.findMany({
where: user?.UserRoles.find((roleDef) => roleDef.RoleId === RoleId.SuperAdmin)
? undefined
: {
OrganizationMemberships: {
every: {
UserId: userId
}
}
},
select: {
Id: true,
Name: true,
LogoUrl: true,
Owner: {
select: {
Name: true
}
},
include: {
Owner: true
}
});
}
});
return { organizations, numberOfTasks };
};
Loading

0 comments on commit 45a94f5

Please sign in to comment.