mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
22 lines
377 B
TypeScript
22 lines
377 B
TypeScript
import { prisma } from '@documenso/prisma';
|
|
|
|
export const deleteUser = async (name: string) => {
|
|
const user = await prisma.user.findFirst({
|
|
where: {
|
|
name: {
|
|
contains: name,
|
|
},
|
|
},
|
|
});
|
|
|
|
if (!user) {
|
|
throw new Error(`User with name ${name} not found`);
|
|
}
|
|
|
|
return await prisma.user.delete({
|
|
where: {
|
|
id: user.id,
|
|
},
|
|
});
|
|
};
|