Example #1
0
def export():
    if request.method == 'GET':
        user = UserController.find_by_id(request.args.get("user_id"))
        query_sets = EmployeeController.get_items(user.user_handle_industry)
        column_names = EmployeeController.get_columns_name()
        return excel.make_response_from_query_sets(query_sets, column_names,
                                                   "xlsx")
Example #2
0
def get_items(industry_area):
    item_schema = EmployeeSchema(many=True)
    item_list = EmployeeController.get_items(industry_area)
    if item_list is None:
        response = {'message': 'No employee created.'}
        return jsonify(response), 404
    result = item_schema.dump(item_list)
    # json_response = json.loads(result)
    response = {
        'data_response': result,
    }
    return jsonify(response), 200