Exemplo n.º 1
0
def get_cards_for_board(board_id: int, status_id: int):
    """
    All cards that belongs to a board
    :param status_id: id of the statuses board
    :param board_id: id of the parent board
    """
    return data_handler.get_cards(board_id, status_id)
Exemplo n.º 2
0
def rename_card_save():
    cards = data_handler.get_cards()
    data = request.get_json()
    card_title = data["titles"].split(",")
    for i in range(len(cards)):
        cards[i]["title"] = card_title[i]
    data_handler.save_dict_to_cards_csv(cards)
Exemplo n.º 3
0
def del_card():
    cards = data_handler.get_cards()
    data = request.get_json()
    for i in range(len(cards)):
        if cards[i]["id"] == data["id"]:
            del cards[i]
            data_handler.save_dict_to_cards_csv(cards)
            return make_response(jsonify({"message": "JSON received"}), 200)
Exemplo n.º 4
0
def save_card_position():
    cards = data_handler.get_cards()
    statuses = data_handler.get_statuses()
    data = request.get_json()
    for status in statuses:
        if status['title'] == data['status']:
            status_id = status['id']
    for card in cards:
        if card['id'] == data['cardId']:
            card['board_id'] = data['boardId']
            card['status_id'] = status_id
            card['order'] = data['position']
    data_handler.save_dict_to_cards_csv(cards)
    return make_response(jsonify({"message": "JSON received"}), 200)
Exemplo n.º 5
0
def add_new_card():
    cards = data_handler.get_cards()
    max_id = 0
    for card in cards:
        if int(card['id']) > max_id:
            max_id = int(card['id'])
    data = request.get_json()
    new_card = {
        'id': max_id + 1,
        'board_id': data['boardId'],
        'title': data['cardName'],
        'status_id': 0,
        'order': data['position']
    }
    cards.append(new_card)
    data_handler.save_dict_to_cards_csv(cards)
    return make_response((jsonify({'message': "JSON received"})), 200)
Exemplo n.º 6
0
def show_cards():
    if request.method == "GET":
        return data_handler.get_cards()
Exemplo n.º 7
0
def get_cards():
    """
    All the boards
    """

    return data_handler.get_cards()
Exemplo n.º 8
0
def delete_card(card_id: int):
    data_handler.delete_card(card_id)

    return data_handler.get_cards()
Exemplo n.º 9
0
def create_new_card(board_id: int, status_id: int):
    data_handler.create_new_card(board_id, status_id)
    return data_handler.get_cards(board_id, status_id)
Exemplo n.º 10
0
def get_cards():
    """
    Return cards with all the card details
    """
    return data_handler.get_cards()