fix: Use hashPassword utility instead of dynamic bcrypt import
This commit is contained in:
parent
458913bdf8
commit
555a22b846
1 changed files with 3 additions and 3 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
import { FastifyRequest, FastifyReply } from 'fastify';
|
import { FastifyRequest, FastifyReply } from 'fastify';
|
||||||
|
import { hashPassword } from '../utils/password';
|
||||||
|
|
||||||
export const getUsers = async (request: FastifyRequest, reply: FastifyReply) => {
|
export const getUsers = async (request: FastifyRequest, reply: FastifyReply) => {
|
||||||
// ... existing implementation ...
|
// ... existing implementation ...
|
||||||
|
|
@ -83,9 +84,8 @@ export const createUser = async (request: FastifyRequest, reply: FastifyReply) =
|
||||||
return reply.code(409).send({ message: 'User with this email already exists' });
|
return reply.code(409).send({ message: 'User with this email already exists' });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hash password with bcrypt
|
// Hash password
|
||||||
const bcrypt = await import('bcrypt');
|
const hashedPassword = await hashPassword(data.password);
|
||||||
const hashedPassword = await bcrypt.hash(data.password, 10);
|
|
||||||
|
|
||||||
// Create user
|
// Create user
|
||||||
const user = await request.server.prisma.user.create({
|
const user = await request.server.prisma.user.create({
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue