Basic solution
Let's first solve the problem, and after that improve the solution.
yarn add bcrypt
yarn add -D @types/bcryptprivate async hashPassword(password: string) {
const salt = await genSalt();
return hash(password, salt);
}const { password } = createUserDto;
const hashedPassword = await this.hashPassword(password);
const user = this.usersRepository.create({
...createUserDto,
password: hashedPassword,
});Last updated