Files
documenso/packages/lib/server-only/user/update-profile.ts
2023-11-06 13:01:12 +11:00

29 lines
505 B
TypeScript

import { prisma } from '@documenso/prisma';
export type UpdateProfileOptions = {
userId: number;
name: string;
signature: string;
};
export const updateProfile = async ({ userId, name, signature }: UpdateProfileOptions) => {
// Existence check
await prisma.user.findFirstOrThrow({
where: {
id: userId,
},
});
const updatedUser = await prisma.user.update({
where: {
id: userId,
},
data: {
name,
signature,
},
});
return updatedUser;
};