mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 00:03:33 +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;
|
||||
};
|
||||
Reference in New Issue
Block a user