Ejemplo n.º 1
0
 def find_by(self, _id):
     customers = self.find_all()
     if customers:
         customer = Common.filter_result('customer_id', _id, customers)
         return next(customer, None)
     return None
Ejemplo n.º 2
0
 def find_by_email(self, _email):
     customers = self.find_all()
     if customers:
         customer = Common.filter_result('email', _email, customers)
         return next(customer, None)
     return None
Ejemplo n.º 3
0
 def find_by_customer(self, customer_id):
     carts = self.find_all()
     customer = Common.filter_result('customer_id', customer_id, carts)
     return next(customer, None)
Ejemplo n.º 4
0
 def find_by_item(self, item_id, cart):
     item = Common.filter_result('item_id', item_id, cart["items"])
     return next(item, None)
Ejemplo n.º 5
0
 def find_by(self, _id):
     orders = self.find_all()
     order = Common.filter_result('order_id', _id, orders)
     return next(order, None)
Ejemplo n.º 6
0
 def search_by(self, customer_id, order_id):
     customer_orders = self.find_by_customer(customer_id)
     order = Common.filter_result('order_id', order_id, customer_orders)
     return next(order, None)
Ejemplo n.º 7
0
 def find_by_customer(self, _id):
     orders = self.find_all()
     customer_orders = Common.filter_result('customer_id', _id, orders)
     return list(customer_orders)
Ejemplo n.º 8
0
 def find_by_name(self, products, _name):
     product_name = _name.replace('_', ' ')
     product = Common.filter_result('name', product_name, products)
     return next(product, None)
Ejemplo n.º 9
0
 def find_by(self, products, _id):
     product = Common.filter_result('product_id', _id, products)
     return next(product, None)