fix case issue that caused rename prob

This commit is contained in:
Aaron William Po
2023-02-09 04:16:03 -05:00
parent dbd342fd3e
commit 9ba51c1ab3
7 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
import { hashPassword } from '@/config/auth/passwordFns';
import DBClient from '@/prisma/DBClient';
import { z } from 'zod';
import CreateUserValidationSchema from './schema/CreateUserValidationSchema';
import GetUserSchema from './schema/GetUserSchema';
const createNewUser = async ({
email,
password,
firstName,
lastName,
dateOfBirth,
username,
}: z.infer<typeof CreateUserValidationSchema>) => {
const hash = await hashPassword(password);
const user: z.infer<typeof GetUserSchema> = await DBClient.instance.user.create({
data: {
username,
email,
hash,
firstName,
lastName,
dateOfBirth: new Date(dateOfBirth),
},
select: {
id: true,
username: true,
email: true,
firstName: true,
lastName: true,
dateOfBirth: true,
createdAt: true,
},
});
return user;
};
export default createNewUser;