added endpoints for retreiving info about items
This commit is contained in:
		@@ -64,6 +64,12 @@ class AbstractProductService {
 | 
			
		||||
        if (!result) return false;
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    async getByLocalId(groupId, localId) {
 | 
			
		||||
        let result = (await db.query("SELECT * FROM abstract_products WHERE group_id = $1 AND local_id = $2", [groupId, localId]))
 | 
			
		||||
        if (result.rowCount == 0) throw new customError(`Abstract product not found`, responses.responses.abstractproducts.not_found)
 | 
			
		||||
        return result.rows[0]
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export default new AbstractProductService();
 | 
			
		||||
@@ -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();
 | 
			
		||||
		Reference in New Issue
	
	Block a user