def get_reclamation_list(id, **kwargs): """Private""" q = Reclamation.query.filter_by(supplier_id=id) q, count = create_filter(Reclamation, q, kwargs) reclamations = q.all() return make_response( status_code=200, status='success', count=count, data=ReclamationSchema(many=True).dump(reclamations).data)
def get_reclamation_list(**kwargs): """Admin""" q = Reclamation.query q, count = create_filter(Reclamation, q, kwargs) reclamations = q.all() return make_response(status_code=200, status='success', message=None, count=count, data=reclamations_schema.dump(reclamations).data)
def get_user_list(**kwargs): """Admin""" q = db.session.query(User) q, count = create_filter(User, q, kwargs) users = q.all() return make_response(status_code=200, status='success', message=None, count=count, data=users_schema.dump(users).data)
def get_payment_type_list(**kwargs): """Private""" q = PaymentType.query q, count = create_filter(PaymentType, q, kwargs) payment_types = q.all() return make_response(status_code=200, status='success', message=None, count=count, data=payment_types_schema.dump(payment_types).data)
def get_supplier_list(**kwargs): """Private""" q = Supplier.query q, count = create_filter(Supplier, q, kwargs) suppliers = q.all() return make_response(status_code=200, status='success', message=None, count=count, data=SupplierSchema(many=True, exclude=['supplier_user_infos' ]).dump(suppliers).data)
def get_station_list(args, id, **kwargs): """Private""" q = Station.query.filter(Station.supplier.has(id=id)) if args.get('filter', None): filter_str = '%{}%'.format(args['filter']) q = q.filter(Station.name.ilike(filter_str)).order_by( func.similarity(Station.name, args['filter']).desc()) q, count = create_filter(Station, q, kwargs) stations = q.all() return make_response(status_code=200, status='success', message=None, count=count, data=StationSchema(many=True).dump(stations).data)
def get_station_list(args, **kwargs): """Private""" filter_str = '%{}%'.format(args['filter']) q = Station.query.filter(Station.supplier.has(key=args['supplier_key']), Station.name.ilike(filter_str)).order_by( func.similarity(Station.name, args['filter']).desc()) q, count = create_filter(Station, q, kwargs) stations = q.all() return make_response( status_code=200, status='success', message= 'This method has been replaced by "../supplier/<id>/station/ and should be considered deprecated.', count=count, data=stations_schema.dump(stations).data)