;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
This commit is contained in:
@@ -7,7 +7,7 @@ class ProductService {
|
||||
await db.query("INSERT INTO products (group_id, local_id, abstract_product_id, amount, date_of_production, expiry_date) VALUES ($1, $2, $3, $4, $5, $6)", [groupid, localid, abstract_product_id, amount, date_of_production, expiry_date])
|
||||
.catch((e) => {
|
||||
errorHandler(e, "Abstract Product")
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
async updateAbstractProductId(groupId, localId, abstract_product_id) {
|
||||
@@ -29,20 +29,20 @@ class ProductService {
|
||||
await db.query("UPDATE products SET date_of_production = $1 WHERE group_id = $2 AND local_id = $3", [date_of_production, groupId, localId])
|
||||
.catch((e) => {
|
||||
errorHandler(e, "date of production")
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
async updateExpiryDate(groupId, localId, expiry_date) {
|
||||
await db.query("UPDATE products SET expiry_date = $1 WHERE group_id = $2 AND local_id = $3", [expiry_date, groupId, localId])
|
||||
.catch((e) => {
|
||||
errorHandler(e, "expiry date")
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
async getAll(groupId) {
|
||||
let result = (await db.query("SELECT local_id, abstract_product_id, amount, date_of_production, expiry_date FROM products WHERE group_id = $1", [groupId])).rows
|
||||
let result = (await db.query("SELECT local_id, abstract_product_id, amount, date_of_production, expiry_date FROM products WHERE group_id = $1", [groupId])).rows;
|
||||
if (!result) return statuses.not_found;
|
||||
return result
|
||||
return result;
|
||||
}
|
||||
|
||||
async exists(groupId, localId) {
|
||||
|
||||
Reference in New Issue
Block a user