示例#1
0
def delete_board(id):
    board = Board.get_or_none(Board.id == id)
    if not board:
        return jsonify({'message': 'ERROR', 'result': None}), 404

    board.delete_instance()
    return jsonify({'message': 'OK', 'result': None})
示例#2
0
def update_board(id):
    board = Board.get_or_none(Board.id == id)
    if not board:
        return jsonify({'message': 'ERROR', 'result': None}), 404

    board.name = request.json.get('name')
    board.description = request.json.get('description')
    board.image = request.json.get('image')
    board.linkedin = request.json.get('linkedin')
    board.position = request.json.get('position')
    board.save()

    return jsonify({'message': 'OK', 'result': board})
示例#3
0
def get_board(id):
    board = Board.get_or_none(Board.id == id)
    if board:
        return jsonify({'message': 'OK', 'result': board.to_dict()})
    else:
        return jsonify({'message': 'ERROR', 'result': None}), 404