Пример #1
0
def update_card(card_id: int, data: int) -> bool:
    card = Cards.query.filter_by(id=card_id).first()
    if data['column_id'] != card.column_id:
        card.column_id = int(data['column_id'])
    elif card.index != int(data['index']):
        card.column_id = int(data['index'])
    return db_manager.commit_to_database(card)
Пример #2
0
def register_new_user(data) -> bool:
    email = data['email']
    name = data['name']
    password = data['password']
    user = Users(
        email=email,
        name=name,
        password=bcrypt.generate_password_hash(password).decode('utf-8'))
    return db_manager.commit_to_database(user)
Пример #3
0
def add_new_board(data: dict, user_id: int) -> bool:
    name = data['name']
    note = data['note']
    board = Boards(name=name, owner_id=user_id, note=note)
    return db_manager.commit_to_database(board)
Пример #4
0
def update_card_name(card_id: int, new_name: int) -> bool:
    card = Cards.query.filter_by(id=card_id).first()
    card.name = new_name['name']
    return db_manager.commit_to_database(card)
Пример #5
0
def update_card_column(card_id: int, data: dict) -> bool:
    card = Cards.query.filter_by(id=card_id).first()
    card.column_id = int(data['column_id'])
    card.index = int(data['index'])
    return db_manager.commit_to_database(card)
Пример #6
0
def update_column_index(column_id: int, data: dict) -> bool:
    column = Columns.query.filter_by(id=column_id).first()
    column.index = int(data['index'])
    return db_manager.commit_to_database(column)