Beispiel #1
0
def productsPage():
    name = request.args.get('name')
    start_price = request.args.get('start_price')
    end_price = request.args.get('end_price')
    records_per_page = int(request.args.get('table_size'))
    page = int(request.args.get('page'))
    sort_by = request.args.get('sort_by')
    index_sort = request.args.get('index_sort')
    prods, records_amount = Product.listProducts(name, start_price, end_price, page, sort_by, index_sort, records_per_page)
    products_arr = []
    for i in prods:
        products_arr.append({'id': i.id, 'name': i.name, 'price': str(i.price), 'description': i.description})
    status_list = list_dimensions()
    status_arr = []
    for i in status_list:
        status_arr.append({'id': i.id, 'name': i.name})
    return make_response(jsonify(products=products_arr,status=status_arr, records_amount=records_amount,
                                 records_per_page=records_per_page), 200)
Beispiel #2
0
def dimensions():
    dimensions_list = list_dimensions()
    dimensions_arr = []
    for i in dimensions_list:
        dimensions_arr.append({'id': i.id, 'name': i.name})
    return make_response(jsonify(dimensions=dimensions_arr), 200)