Skip to content

Commit

Permalink
Remove password.
Browse files Browse the repository at this point in the history
  • Loading branch information
briancao committed Aug 18, 2023
1 parent cf14a7a commit 1aa4070
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions queries/admin/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export async function getUserByUsername(username: string, options: GetUserOption
}

export async function getUsers(
UserSearchFilter: UserSearchFilter = {},
UserSearchFilter: UserSearchFilter,
options?: { include?: Prisma.UserInclude },
): Promise<FilterResult<User[]>> {
const { teamId, filter, filterType = USER_FILTER_TYPES.all } = UserSearchFilter;
Expand Down Expand Up @@ -72,14 +72,22 @@ export async function getUsers(
...UserSearchFilter,
});

const users = await prisma.client.user.findMany({
where: {
...where,
deletedAt: null,
},
...pageFilters,
...(options?.include && { include: options.include }),
});
const users = await prisma.client.user
.findMany({
where: {
...where,
deletedAt: null,
},
...pageFilters,
...(options?.include && { include: options.include }),
})
.then(a => {
return a.map(a => {
const { password, ...rest } = a;

return rest;
});
});
const count = await prisma.client.user.count({
where: {
...where,
Expand Down

0 comments on commit 1aa4070

Please sign in to comment.