update: add delete user api route, AuthProvider extracted from App.tsx

This commit is contained in:
Aaron William Po
2023-06-04 13:26:14 -04:00
parent e3da430425
commit 140abaa5a1
12 changed files with 129 additions and 59 deletions

View File

@@ -0,0 +1,25 @@
import DBClient from '@/prisma/DBClient';
import { z } from 'zod';
import GetUserSchema from './schema/GetUserSchema';
const deleteUserById = async (id: string) => {
const deletedUser: z.infer<typeof GetUserSchema> | null =
await DBClient.instance.user.delete({
where: { id },
select: {
id: true,
username: true,
email: true,
firstName: true,
lastName: true,
dateOfBirth: true,
createdAt: true,
accountIsVerified: true,
updatedAt: true,
},
});
return deletedUser;
};
export default deleteUserById;