documenso/packages/lib/server-only/admin/update-user.ts

24 lines
445 B
TypeScript
Raw Normal View History

2025-01-02 04:33:37 +00:00
import type { Role } from '@prisma/client';
2023-09-29 16:12:02 +00:00
import { prisma } from '@documenso/prisma';
export type UpdateUserOptions = {
2023-09-29 16:26:37 +00:00
id: number;
2023-10-02 10:38:04 +00:00
name: string | null | undefined;
email: string | undefined;
roles: Role[] | undefined;
2023-09-29 16:12:02 +00:00
};
2023-09-29 16:26:37 +00:00
export const updateUser = async ({ id, name, email, roles }: UpdateUserOptions) => {
2025-08-24 22:23:48 +00:00
await prisma.user.update({
2023-09-29 16:12:02 +00:00
where: {
2023-09-29 16:26:37 +00:00
id,
2023-09-29 16:12:02 +00:00
},
data: {
name,
email,
roles,
},
});
};