chore: format
This commit is contained in:
@@ -451,9 +451,7 @@ class ChatTable:
|
||||
# Clean up orphaned old tags in one query
|
||||
removed = set(old_tags) - set(new_tag_ids)
|
||||
if removed:
|
||||
self.delete_orphan_tags_for_user(
|
||||
list(removed), user.id, db=db
|
||||
)
|
||||
self.delete_orphan_tags_for_user(list(removed), user.id, db=db)
|
||||
|
||||
return ChatModel.model_validate(chat)
|
||||
|
||||
@@ -1380,9 +1378,7 @@ class ChatTable:
|
||||
with get_db_context(db) as db:
|
||||
orphans = []
|
||||
for tag_id in tag_ids:
|
||||
count = self.count_chats_by_tag_name_and_user_id(
|
||||
tag_id, user_id, db=db
|
||||
)
|
||||
count = self.count_chats_by_tag_name_and_user_id(tag_id, user_id, db=db)
|
||||
if count <= threshold:
|
||||
orphans.append(tag_id)
|
||||
Tags.delete_tags_by_ids_and_user_id(orphans, user_id, db=db)
|
||||
|
||||
@@ -218,11 +218,7 @@ class GroupTable:
|
||||
)
|
||||
)
|
||||
|
||||
results = (
|
||||
query.group_by(Group.id)
|
||||
.order_by(Group.updated_at.desc())
|
||||
.all()
|
||||
)
|
||||
results = query.group_by(Group.id).order_by(Group.updated_at.desc()).all()
|
||||
|
||||
return [
|
||||
GroupResponse.model_validate(
|
||||
|
||||
@@ -123,9 +123,9 @@ class TagTable:
|
||||
return True
|
||||
try:
|
||||
with get_db_context(db) as db:
|
||||
db.query(Tag).filter(
|
||||
Tag.id.in_(ids), Tag.user_id == user_id
|
||||
).delete(synchronize_session=False)
|
||||
db.query(Tag).filter(Tag.id.in_(ids), Tag.user_id == user_id).delete(
|
||||
synchronize_session=False
|
||||
)
|
||||
db.commit()
|
||||
return True
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user