This commit is contained in:
leca 2024-10-31 09:50:17 +03:00
parent 9cd1debd4a
commit d809abd17b
1 changed files with 0 additions and 1 deletions

View File

@ -6,7 +6,6 @@ import errorHandler from '../utils/pgerrorhandler.js';
class UserService { class UserService {
async create(username, password) { async create(username, password) {
if (await this.getByUsername(username)) throw new customError(`Such user exists`, responseCodes.responses.user.duplicate);
await db.query("INSERT INTO users (username, password) VALUES ($1, $2)", [username, bcrypt.hashSync(password, 12)]).catch((e) => { await db.query("INSERT INTO users (username, password) VALUES ($1, $2)", [username, bcrypt.hashSync(password, 12)]).catch((e) => {
errorHandler(e, "user"); errorHandler(e, "user");
}) })