예제 #1
0
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))
예제 #2
0
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))
예제 #3
0
def delete_task(item_id):
    return jsonify(TaskService().delete(item_id))
예제 #4
0
def get_tasks():
    return jsonify({'tasks': TaskService().list()})
예제 #5
0
파일: app.py 프로젝트: andrestoga/worktest
def update_item(item_id):
    return jsonify(TaskService().update(item_id, request.get_json()))
예제 #6
0
파일: app.py 프로젝트: andrestoga/worktest
def add_tasks():
    return jsonify(TaskService().add(request.get_json()))
예제 #7
0
파일: app.py 프로젝트: andrestoga/worktest
def list_tasks():
    return jsonify(TaskService().list())
예제 #8
0
def searchApp():
    params = RequestUtils.loadParams()
    taskJobParam = RequestUtils.parseResToClass(params, TaskJobParam)
    TaskService.search(taskJobParam)