|
@@ -234,3 +234,33 @@ def get_all_inventory_groups() :
|
|
|
|
|
|
def get_inventory_group(group_id) :
|
|
def get_inventory_group(group_id) :
|
|
return __getItem(group_id,inventory_group)
|
|
return __getItem(group_id,inventory_group)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+## AGREGATION METHODS
|
|
|
|
+## method a bit smart to have processed data
|
|
|
|
+def get_inventory_group_items(group_id) :
|
|
|
|
+ with persistence.get_Session_Instance() as sess :
|
|
|
|
+ group : inventory_group = sess.query(inventory_group).filter(inventory_group.id == group_id).first()
|
|
|
|
+
|
|
|
|
+ return sess.query(inventory_item).filter(inventory_item.group_id == group.id)
|
|
|
|
+
|
|
|
|
+def get_inventory_site_items(site_id) :
|
|
|
|
+ with persistence.get_Session_Instance() as sess :
|
|
|
|
+ site : inventory_site = sess.query(inventory_site).filter(inventory_site.id == site_id).first()
|
|
|
|
+
|
|
|
|
+ return sess.query(inventory_item).filter(inventory_item.site_id == site.id)
|
|
|
|
+
|
|
|
|
+def get_inventory_contact_items(contact_id) :
|
|
|
|
+ with persistence.get_Session_Instance() as sess :
|
|
|
|
+ contact : inventory_contact = sess.query(inventory_contact).filter(inventory_contact.id == contact_id).first()
|
|
|
|
+
|
|
|
|
+ return sess.query(inventory_item).filter(inventory_item.contact_id == contact.id)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+def get_inventory_items_by_tag(str : str) :
|
|
|
|
+ #TODO get all tags
|
|
|
|
+ raise Exception("not implemented yet")
|
|
|
|
+ with persistence.get_Session_Instance() as sess :
|
|
|
|
+ return sess.query(inventory_contact).filter(inventory_contact.tags.contains(str))
|