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

@@ -257,7 +257,7 @@ func firstOrCreateAISession(tx *gorm.DB, session models.SaAISession) error {
}
func firstOrCreateDocument(tx *gorm.DB, projectID, userID uint, name, markdown string) error {
var document models.SaDocument
var document models.SaDocumentTree
err := tx.Where("project_id = ? AND normalized_name = ?", projectID, strings.ToLower(name)).First(&document).Error
if err == nil {
return nil
@@ -265,7 +265,7 @@ func firstOrCreateDocument(tx *gorm.DB, projectID, userID uint, name, markdown s
if err != gorm.ErrRecordNotFound {
return err
}
document = models.SaDocument{
document = models.SaDocumentTree{
ProjectID: projectID, CreatedBy: userID, Kind: models.DocumentKindFile,
Name: name, NormalizedName: strings.ToLower(name), Extension: ".md",
MimeType: "text/markdown; charset=utf-8", Size: int64(len([]byte(markdown))),