def remove_appointed_by(self, to_remove): owners = session.query(OwnerORM).filter_by(appointed_by=to_remove) for owner in owners: owner.remove() managers = session.query(OwnerORM).filter_by(appointed_by=to_remove) for manager in managers: manager.remove() session.commit()
def find_by_id(discount_id): session.query(DiscountORM).filter_by(discount_id=discount_id).first()
def find_store_purchases(self, store_id): return session.query(PurchaseORM).filter_by(store_id=store_id)
def find_user_purchases(self, username): return session.query(PurchaseORM).filter_by(username=username)
def getPurchases(self): return session.query(PurchaseORM).filter_by(store_id=id)
def remove_permission(self, manager, permission): session.query(ManagerPermissionORM).delete.where(username=manager, store_id=self.id, permission=permission) session.commit()
def remove_manager(self, to_remove): self.remove_appoint_by(to_remove) session.query(ManagerORM).delete.where(username=to_remove) session.commit()
def find_pass(username): return session.query(SecurityORM).filter_by(username=username).first()
def find_store(store_id): return session.query(StoreORM).filter_by(store_id=store_id).first()
def delete(self): session.query(ProductORM).delete.where(name=self.name, store_id=self.store_id)
def find_product(name, store_id): return session.query(ProductORM).filter_by(name=name, store_id=store_id).first()
def find_by_username(username): return session.query(RegisteredUserORM).filter_by( username=username).first()
def createObject(self): session.query(ProductsInBasketORM).filter_by()
def remove_basket(self): session.query(ProductsInBasketORM).delete.where(basket_id=self.id) session.query(BasketORM).delete.where(id=self.id) session.commit()
def remove_product_from_basket(self, product_name): session.query(ProductsInBasketORM).delete.where( basket_id=self.id, product_name=product_name) session.commit()
def find_user_baskets(self, username): return session.query(BasketORM).filter_by(username=username).first()