def find_all(query: Query = None, page: int = 1, page_size: int = 1000) -> List['Customer']: return [ Customer.from_db(customer) for customer in db.get_customers(query, page, page_size) ]
def get_customers(): try: customers = db.get_customers() except Exception as e: return jsonify(status="error", message=str(e)), 500 if len(customers): return jsonify(status="ok", total=len(customers), customers=customers, time=datetime.datetime.utcnow()) else: return jsonify(status="ok", message="not found", total=0, customers=[], time=datetime.datetime.utcnow())
def get_customers(): try: customers = db.get_customers() except Exception as e: return jsonify(status="error", message=str(e)), 500 if len(customers): return jsonify( status="ok", total=len(customers), customers=customers, time=datetime.datetime.utcnow() ) else: return jsonify( status="ok", message="not found", total=0, customers=[], time=datetime.datetime.utcnow() )
def find_all(query: Query=None) -> List['Customer']: return [Customer.from_db(customer) for customer in db.get_customers(query)]
def find_all(query=None): return [ Customer.from_db(customer) for customer in db.get_customers(query) ]