Files
var-monorepo/apps/hub/app/(auth)/register/action.ts
2025-01-27 01:45:03 +01:00

18 lines
366 B
TypeScript

'use server';
import { prisma, Prisma } from '@repo/db';
import bcrypt from 'bcryptjs';
export const register = async ({
password,
...user
}: Prisma.UserCreateInput) => {
const hashedPassword = await bcrypt.hash(password, 15);
const newUser = prisma.user.create({
data: {
...user,
password: hashedPassword,
},
});
return newUser;
};