feat: implement change password

This commit is contained in:
Aaron William Po
2023-05-28 20:05:00 -04:00
parent d06415c924
commit f4e6a307f2
10 changed files with 265 additions and 2 deletions

View File

@@ -31,6 +31,7 @@ const createNewUser = async ({
dateOfBirth: true,
createdAt: true,
accountIsVerified: true,
updatedAt: true,
},
});

View File

@@ -69,3 +69,11 @@ export const CreateUserValidationSchemaWithUsernameAndEmailCheck =
message: 'Passwords do not match.',
path: ['confirmPassword'],
});
export const UpdatePasswordSchema = BaseCreateUserSchema.pick({
password: true,
confirmPassword: true,
}).refine((data) => data.password === data.confirmPassword, {
message: 'Passwords do not match.',
path: ['confirmPassword'],
});

View File

@@ -4,7 +4,7 @@ const GetUserSchema = z.object({
id: z.string().uuid(),
username: z.string(),
createdAt: z.coerce.date(),
updatedAt: z.coerce.date().optional(),
updatedAt: z.coerce.date().nullable(),
email: z.string().email(),
firstName: z.string(),
lastName: z.string(),