mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
28 lines
498 B
TypeScript
28 lines
498 B
TypeScript
import { AppError } from '@documenso/lib/errors/app-error';
|
|
import { prisma } from '@documenso/prisma';
|
|
|
|
export type EnableUserOptions = {
|
|
id: number;
|
|
};
|
|
|
|
export const enableUser = async ({ id }: EnableUserOptions) => {
|
|
const user = await prisma.user.findFirst({
|
|
where: {
|
|
id,
|
|
},
|
|
});
|
|
|
|
if (!user) {
|
|
throw new AppError('There was an error enabling the user');
|
|
}
|
|
|
|
await prisma.user.update({
|
|
where: {
|
|
id,
|
|
},
|
|
data: {
|
|
disabled: false,
|
|
},
|
|
});
|
|
};
|