Files
sign/packages/lib/server-only/user/update-profile.ts

29 lines
505 B
TypeScript
Raw Normal View History

2023-06-09 18:21:18 +10:00
import { prisma } from '@documenso/prisma';
export type UpdateProfileOptions = {
userId: number;
name: string;
signature: string;
};
2023-09-01 18:43:53 +10:00
export const updateProfile = async ({ userId, name, signature }: UpdateProfileOptions) => {
2023-06-09 18:21:18 +10:00
// Existence check
await prisma.user.findFirstOrThrow({
where: {
id: userId,
},
});
const updatedUser = await prisma.user.update({
where: {
id: userId,
},
data: {
name,
2023-09-01 18:43:53 +10:00
signature,
2023-06-09 18:21:18 +10:00
},
});
return updatedUser;
};