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

11
src/utils/hash.js Normal file
View File

@@ -0,0 +1,11 @@
import { createHash } from 'node:crypto'
const hashAbstractProduct = (barcode, name, net_weight, image_filename, category, unit) => {
return createHash('md5').update(`${barcode}${name}${net_weight}${image_filename}${category}${unit}`).digest('hex');
}
const hashProduct = (abstract_product_id, amount, date_of_production, expiry_date) => {
return createHash('md5').update(`${abstract_product_id}${amount}${date_of_production}${expiry_date}`).digest('hex');
}
export default { hashAbstractProduct, hashProduct };