Files
the-biergarten-app/services/User/updateUserToBeConfirmedById.ts
Aaron William Po 584e3b349f Implement confirm user functionality
This commit adds the necessary functionality to confirm a user's account.

It includes the addition of a new column in the user table to track whether an account is confirmed or not, and the implementation of JWT for confirmation tokens.

This commit integrates the SparkPost API as well as React Email to send dynamic emails for whatever purpose.

Upon user registration, a confirmation email will be sent to the user.
2023-03-13 22:35:57 -04:00

25 lines
631 B
TypeScript

import GetUserSchema from '@/services/User/schema/GetUserSchema';
import DBClient from '@/prisma/DBClient';
import { z } from 'zod';
const updateUserToBeConfirmedById = async (id: string) => {
const user: z.infer<typeof GetUserSchema> = await DBClient.instance.user.update({
where: { id },
data: { isAccountVerified: true, updatedAt: new Date() },
select: {
id: true,
username: true,
email: true,
isAccountVerified: true,
createdAt: true,
firstName: true,
lastName: true,
dateOfBirth: true,
},
});
return user;
};
export default updateUserToBeConfirmedById;