Пример #1
0
def add_links_from_json_file():
    # FIXME need test
    file = request.files['json_file']

    action_result = UserManager.add_user_batch(file)
    resp = jsonify(action_result.pack())
    resp.headers['Access-Control-Allow-Origin'] = '*'
    return resp
Пример #2
0
def get_user_by_id():
    param = UserQueryByIdParam()
    if param.validate_on_submit():
        action_result = UserManager.get_user_by_id(param.user_id.data)
    else:
        action_result = param.check_result

    resp = jsonify(action_result.pack())
    resp.headers['Access-Control-Allow-Origin'] = '*'
    return resp
Пример #3
0
def user_update():
    param = UserUpdateParam()
    if param.validate_on_submit():
        action_result = UserManager.update_user(param.user_info.data)
    else:
        action_result = param.check_result

    resp = jsonify(action_result.pack())
    resp.headers['Access-Control-Allow-Origin'] = '*'
    return resp
Пример #4
0
def user_del():
    post = UserDeleteParam()
    if post.validate_on_submit():
        action_result = UserManager.del_users_by_ids(post.user_ids.data)
    else:
        action_result = post.check_result

    resp = jsonify(action_result.pack())
    resp.headers['Access-Control-Allow-Origin'] = '*'
    return resp
Пример #5
0
def user_add():
    post = UserAddParam()
    if post.validate_on_submit():
        action_result = UserManager.add_user(post.user_info.data)
    else:
        action_result = post.check_result

    resp = jsonify(action_result.pack())
    resp.headers['Access-Control-Allow-Origin'] = '*'
    return resp
Пример #6
0
def get_users_by_page():
    param = UserQueryParam()
    if param.validate_on_submit():
        action_result = UserManager.get_users_by_page(param.page.data,
                                                      param.page_size.data,
                                                      param.conditions.data)
    else:
        action_result = param.check_result

    resp = jsonify(action_result.pack())
    resp.headers['Access-Control-Allow-Origin'] = '*'
    return resp