make user full name mandatory
This commit is contained in:
@ -6,17 +6,17 @@ import notifyEmailChangeQueue from "../api/queue/notify-email-change";
|
||||
|
||||
const Body = z.object({
|
||||
email: z.string().email(),
|
||||
name: z.string(),
|
||||
fullName: z.string(),
|
||||
});
|
||||
|
||||
export default resolver.pipe(resolver.zod(Body), resolver.authorize(), async ({ email, name }, ctx) => {
|
||||
export default resolver.pipe(resolver.zod(Body), resolver.authorize(), async ({ email, fullName }, ctx) => {
|
||||
const user = await db.user.findFirst({ where: { id: ctx.session.userId! } });
|
||||
if (!user) throw new NotFoundError();
|
||||
|
||||
const oldEmail = user.email;
|
||||
await db.user.update({
|
||||
where: { id: user.id },
|
||||
data: { email, name },
|
||||
data: { email, fullName },
|
||||
});
|
||||
|
||||
if (oldEmail !== email) {
|
||||
|
Reference in New Issue
Block a user