mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
chore: changes
This commit is contained in:
21
packages/lib/server-only/user/delete-user.ts
Normal file
21
packages/lib/server-only/user/delete-user.ts
Normal file
@ -0,0 +1,21 @@
|
||||
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,
|
||||
},
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user