def create_task(): if request.method == "OPTIONS": return build_cors_prelight_response() elif request.method == "POST": post_data = request.get_json() print("post data :") return corsify_actual_response(jsonify( TaskService().create(post_data))) else: raise RuntimeError("Weird - don't know how to handle method {}".format( request.method))
def update_task(item_id): if request.method == "OPTIONS": return build_cors_prelight_response() elif request.method == "PUT": # The actual request following the preflight put_data = request.get_json() # Whatever. print("post data :") return corsify_actual_response( jsonify(TaskService().update(item_id, put_data))) else: raise RuntimeError("Weird - don't know how to handle method {}".format( request.method))
def delete_task(item_id): return jsonify(TaskService().delete(item_id))
def get_tasks(): return jsonify({'tasks': TaskService().list()})
def update_item(item_id): return jsonify(TaskService().update(item_id, request.get_json()))
def add_tasks(): return jsonify(TaskService().add(request.get_json()))
def list_tasks(): return jsonify(TaskService().list())
def searchApp(): params = RequestUtils.loadParams() taskJobParam = RequestUtils.parseResToClass(params, TaskJobParam) TaskService.search(taskJobParam)