a lot of bugfixes, completed abstract products and products

This commit is contained in:
2024-10-27 04:45:13 +03:00
parent a27ce5762c
commit 75f9fb6d7d
24 changed files with 462 additions and 284 deletions

View File

@@ -3,11 +3,9 @@ import statuses from '../utils/status.js';
import bcrypt from 'bcrypt';
class UserService {
async create (username, password) {
await db.query("INSERT INTO users (username, password) VALUES ($1, $2)", [username, bcrypt.hashSync(password, 12)]).catch (e => {
if (e.code == 23505) { // already exists
return statuses.duplicate
}
async create(username, password) {
await db.query("INSERT INTO users (username, password) VALUES ($1, $2)", [username, bcrypt.hashSync(password, 12)]).catch((e) => {
errorHandler(e, "user")
})
return statuses.ok
}