Esempio n. 1
0
def post_data():
    data = request.get_json()
    if request.method == "POST":
        if data['to'] == "boards":
            data_handler.add_board(data, session)
        elif data['to'] == "statuses":
            data_handler.add_status(data)
        elif data['to'] == "cards":
            data_handler.add_card(data)
    elif request.method == "PUT":
        if data['to'] == "boards":
            data_handler.rename_board(data)
        if data['to'] == "cards":
            data_handler.edit_card(data)
    elif request.method == "DELETE":
        if data['to'] == "boards":
            data_handler.delete_board(data)
        elif data['to'] == "statuses":
            data_handler.delete_status(data)
        elif data['to'] == "cards":
            data_handler.delete_card(data)
    else:
        print("f*g, wrong stuff")
Esempio n. 2
0
def delete_board(board_id):
    data_handler.delete_board(board_id)
Esempio n. 3
0
def index():
    if request.method == 'POST':
        card_request = request.form.get('board_id_for_new_card')
        if card_request:
            card_title = request.form['card_title']
            board_id_for_new_card = request.form['board_id_for_new_card']
            new_card_status = data_handler.get_statuses_for_given_board_id(
                board_id_for_new_card)
            data_handler.create_new_card(card_title, board_id_for_new_card,
                                         new_card_status[0]['id'])
            return redirect('/')

        column_request = request.form.get('board_id_for_new_column')
        if column_request:
            new_column_title = request.form['column_title']
            board_id_for_new_column = request.form['board_id_for_new_column']
            # checking for existing statues title
            all_statuses = data_handler.get_all_statuses()
            if new_column_title not in all_statuses:
                data_handler.insert_new_status_title(new_column_title)

            new_status_id = data_handler.get_status_id_by_title(
                new_column_title)
            data_handler.insert_new_board_status(board_id_for_new_column,
                                                 new_status_id[0]['id'])
            return redirect('/')

        rename_column_title_request = request.form.get(
            'status_id_for_new_column_title')
        if rename_column_title_request:
            renamed_column_title = request.form['new_column_title']
            status_id_for_new_title = request.form[
                'status_id_for_new_column_title']
            data_handler.rename_status_title(status_id_for_new_title,
                                             renamed_column_title)
            return redirect('/')

        action_type = request.form['hidden']
        if action_type == 'delete':
            delete_id = request.form['delete_id']
            data_handler.delete_board(delete_id)
            return redirect('/')

        board_title = request.form['board_title']
        if action_type == 'rename':
            board_id = request.form['board_id']
            data_handler.update_board_name(board_id, board_title)
            return redirect('/')
        elif action_type == 'new':
            data_handler.create_new_board(board_title)
            return redirect('/')

        private_type = request.form['privateHidden']
        if private_type == 'private':
            user_id = session['user_id']
            private_title = request.form['private_title']
            data_handler.create_new_private_board(private_title, user_id)
        return redirect('/')
    else:
        boards = data_handler.get_all_public_boards()
        private_boards = {}
        cards = []
        private_cards = []
        statuses = []
        private_statuses = []
        if session:
            user_id = session['user_id']
            private_boards = data_handler.get_private_boards(user_id)
            for private in private_boards:
                private_cards.append(
                    data_handler.get_cards_for_board(private['id']))
                private_statuses.append(
                    data_handler.get_statuses_for_given_board_id(
                        private['id']))
        for board in boards:
            cards.append(data_handler.get_cards_for_board(board['id']))
            statuses.append(
                data_handler.get_statuses_for_given_board_id(board['id']))
        return render_template('index.html',
                               boards=boards,
                               cards=cards,
                               statuses=statuses,
                               private_cards=private_cards,
                               private_boards=private_boards,
                               private_statuses=private_statuses)
Esempio n. 4
0
def delete_board():
    board_id = request.json['board_id']
    data_handler.delete_board(board_id)
Esempio n. 5
0
def delete(board_id: int):
    return data_handler.delete_board(board_id)
Esempio n. 6
0
def delete_board(board_id: int):
    data_handler.delete_board(board_id)

    return data_handler.get_boards()
Esempio n. 7
0
def delete_board(board_id):
    if request.method == 'POST':
        board_id = request.json
        data_handler.delete_board(board_id)
        return board_id
Esempio n. 8
0
def detele_board():
    if request.method == 'POST':
        data = request.json
        data_handler.delete_board(data["board_id"])
Esempio n. 9
0
def delete_board(board_id):
    data_handler.delete_board(board_id)
    return make_response(jsonify({"message": "OK"}), 200)
Esempio n. 10
0
def delete_board():
    board_id = request.json['board_id']
    data_handler.delete_board(board_id)
    return redirect("/")
Esempio n. 11
0
def delete_board():
    board_id = request.get_json()
    response = data_handler.delete_board(board_id)
    return response
Esempio n. 12
0
def remove_board():
    request_content = request.json
    board_id = int(request_content['id'])
    data_handler.delete_board(board_id)
    return jsonify({'success': True})