a lot of fixes, implementing abstract product api endpoints
This commit is contained in:
		
							
								
								
									
										10
									
								
								src/services/abstractproduct.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								src/services/abstractproduct.js
									
									
									
									
									
										Normal 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();
 | 
			
		||||
@@ -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();
 | 
			
		||||
		Reference in New Issue
	
	Block a user