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)
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)
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)
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)
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)
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)