refactor(documents): rename document tree model

This commit is contained in:
2026-07-24 12:23:18 +08:00
parent 1578c81a89
commit ab8ba3c03f
24 changed files with 77 additions and 77 deletions

View File

@@ -10,11 +10,11 @@ import (
)
type workspaceCounts struct {
inbox int64
tasks int64
aiSessions int64
documents int64
cronPlans int64
inbox int64
tasks int64
aiSessions int64
documents int64
cronPlans int64
}
// Workspace 在确认项目归属后执行首屏聚合;后续子查询只接收已授权的内部主键。
@@ -90,7 +90,7 @@ func (s *Service) workspaceCounts(projectID uint) (workspaceCounts, error) {
if err := models.DBService.Model(&models.SaAISession{}).Where("project_id = ?", projectID).Count(&counts.aiSessions).Error; err != nil {
return counts, err
}
if err := models.DBService.Model(&models.SaDocument{}).Where("project_id = ?", projectID).Count(&counts.documents).Error; err != nil {
if err := models.DBService.Model(&models.SaDocumentTree{}).Where("project_id = ?", projectID).Count(&counts.documents).Error; err != nil {
return counts, err
}
if err := models.DBService.Model(&models.SaCronPlan{}).Where("project_id = ?", projectID).Count(&counts.cronPlans).Error; err != nil {
@@ -224,7 +224,7 @@ func (s *Service) workspaceAISessions(projectID uint, projectIdentity string) ([
}
func (s *Service) workspaceDocuments(projectID uint, projectIdentity string) ([]WorkspaceDocumentDTO, error) {
var documents []models.SaDocument
var documents []models.SaDocumentTree
if err := models.DBService.Where("project_id = ?", projectID).Order("updated_at desc, id desc").Limit(50).Find(&documents).Error; err != nil {
return nil, err
}