mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 18:52:06 +00:00
update: add delete user api route, AuthProvider extracted from App.tsx
This commit is contained in:
25
src/services/User/deleteUserById.ts
Normal file
25
src/services/User/deleteUserById.ts
Normal 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;
|
||||
Reference in New Issue
Block a user