a lot of bugfixes, completed abstract products and products
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user