a lot of fixes, implementing abstract product api endpoints

This commit is contained in:
2024-10-26 20:18:14 +03:00
parent e78f20d44e
commit a27ce5762c
11 changed files with 112 additions and 34 deletions

View File

@@ -0,0 +1,10 @@
import db from '../db.js';
class AbstractProductService {
async create (groupid, barcode, name, net_weight, image_filename, category, unit) {
await db.query("INSERT INTO abstract_products (group_id, barcode, name, net_weight, image_filename, category, unit) VALUES ($1, $2, $3, $4, $5, $6, $7)", [groupid, barcode, name, net_weight, image_filename, category, unit]);
}
};
export default new AbstractProductService();

View File

@@ -29,6 +29,10 @@ class GroupService {
async getPassword(id) {
return (await db.query("SELECT password FROM groups WHERE id = $1", [id])).rows[0].password;
}
async getByName(name) {
return (await db.query("SELECT * FROM groups WHERE name = $1", [name])).rows[0]
}
};
export default new GroupService();