added endpoints for retreiving info about items

This commit is contained in:
2024-11-07 21:44:10 +03:00
parent 5853023069
commit 7a89ce2840
8 changed files with 54 additions and 2 deletions

View File

@@ -51,6 +51,12 @@ class ProductService {
if (!result) return false;
return true;
}
async getByLocalId(groupId, localId) {
let result = (await db.query("SELECT * FROM products WHERE group_id = $1 AND local_id = $2", [groupId, localId]));
if (result.rowCount == 0) throw new customError(`getByLocalId product not found`, responseCodes.responses.products.not_found);
return responseCodes.rows[0];
}
};
export default new ProductService();