mirror of
https://github.com/documenso/documenso.git
synced 2025-11-12 15:53:02 +10:00
chore: improve the ui
This commit is contained in:
30
packages/lib/server-only/admin/update-user.ts
Normal file
30
packages/lib/server-only/admin/update-user.ts
Normal file
@ -0,0 +1,30 @@
|
||||
import { prisma } from '@documenso/prisma';
|
||||
import { Role } from '@documenso/prisma/client';
|
||||
|
||||
export type UpdateUserOptions = {
|
||||
userId: number;
|
||||
name: string;
|
||||
email: string;
|
||||
roles: Role[];
|
||||
};
|
||||
|
||||
export const updateUser = async ({ userId, name, email, roles }: UpdateUserOptions) => {
|
||||
console.log('wtf');
|
||||
await prisma.user.findFirstOrThrow({
|
||||
where: {
|
||||
id: userId,
|
||||
},
|
||||
});
|
||||
|
||||
const updatedUser = await prisma.user.update({
|
||||
where: {
|
||||
id: userId,
|
||||
},
|
||||
data: {
|
||||
name,
|
||||
email,
|
||||
roles,
|
||||
},
|
||||
});
|
||||
return updatedUser;
|
||||
};
|
||||
@ -23,6 +23,11 @@ export const findUsers = async ({ page = 1, perPage = 10 }: getAllUsersProps) =>
|
||||
periodEnd: true,
|
||||
},
|
||||
},
|
||||
Document: {
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
skip: Math.max(page - 1, 0) * perPage,
|
||||
take: perPage,
|
||||
|
||||
Reference in New Issue
Block a user