chore: add all the code from original repo
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
'use server';
|
||||
|
||||
import { z } from 'zod';
|
||||
import prisma from '../../../../../prisma/prisma';
|
||||
|
||||
export async function DeleteProfileAction(id: string) {
|
||||
const validatedBody = z.string().safeParse(id);
|
||||
|
||||
if (!validatedBody.success) {
|
||||
throw new Error('Bad request');
|
||||
}
|
||||
|
||||
try {
|
||||
await prisma.profile.delete({
|
||||
where: {
|
||||
id
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
throw new Error(`Failed to delete profile`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user