回收站,软删除(三天自动清空),以及默认链接三十分钟失效

This commit is contained in:
amb
2026-09-02 18:59:42 +08:00
parent bfb7a1a8a2
commit ff3e2a7273
16 changed files with 797 additions and 38 deletions
+5 -2
View File
@@ -56,10 +56,13 @@ class KbPublicService:
return datetime.now() > expires
def get_category_tree(self, kb: KnowledgeBase) -> list[dict]:
"""获取目录树(含文档数量)。"""
"""获取目录树(含文档数量),排除已删除目录"""
stmt = (
select(DocumentCategory)
.where(DocumentCategory.knowledge_base_id == kb.id)
.where(
DocumentCategory.knowledge_base_id == kb.id,
DocumentCategory.deleted_at.is_(None),
)
.order_by(DocumentCategory.sort_order, DocumentCategory.name)
)
all_cats = list(self._session.scalars(stmt).all())