a lot of fixes, implementing abstract product api endpoints
This commit is contained in:
		
							
								
								
									
										11
									
								
								src/utils/hash.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								src/utils/hash.js
									
									
									
									
									
										Normal 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 };
 | 
			
		||||
		Reference in New Issue
	
	Block a user