refactor(documents): rename document owner fields

This commit is contained in:
2026-07-24 12:29:16 +08:00
parent ab8ba3c03f
commit f2d1fef2d6
16 changed files with 68 additions and 21 deletions

View File

@@ -280,7 +280,7 @@ func createConfirmedObject(tx *gorm.DB, item models.SaInboxItem, suggestion mode
name += ".md"
}
document := models.SaDocumentTree{
ProjectID: item.ProjectID, ProjectIdentity: item.ProjectIdentity, CreatedBy: item.CreatedBy,
ProjectID: item.ProjectID, ProjectIdentity: item.ProjectIdentity, OwnerID: item.CreatedBy,
SourceInboxItemID: &sourceInboxItemID, Kind: models.DocumentKindFile, Name: name,
NormalizedName: strings.ToLower(name), Extension: ".md", MimeType: "text/markdown; charset=utf-8",
Size: int64(len([]byte(suggestion.Body))), Revision: 1, ScanStatus: "not_scanned",

View File

@@ -162,7 +162,8 @@ func TestConfirmCreatesOnlySelectedSavedSuggestionsWithInboxIdentity(t *testing.
require.Equal(t, "背景资料.md", documents[1].Name)
for _, document := range documents {
require.Equal(t, fixture.project.ID, document.ProjectID)
require.Equal(t, fixture.owner.ID, document.CreatedBy)
require.Equal(t, fixture.owner.ID, document.OwnerID)
require.Equal(t, fixture.owner.Identity, document.OwnerIdentity)
requireSourceInboxIdentity(t, item, document.SourceInboxItemID, document.SourceInboxItemIdentity)
}
var secondContent models.SaDocumentContent
@@ -267,7 +268,7 @@ func TestRepeatedConfirmReturnsPersistedResultAfterRelatedObjectsChange(t *testi
sourceInboxItemID := item.ID
extraDocument := models.SaDocumentTree{
ProjectID: item.ProjectID, CreatedBy: fixture.owner.ID, SourceInboxItemID: &sourceInboxItemID,
ProjectID: item.ProjectID, OwnerID: fixture.owner.ID, SourceInboxItemID: &sourceInboxItemID,
Kind: models.DocumentKindFile, Name: "后续关联资料.md", NormalizedName: "后续关联资料.md",
Extension: ".md", Revision: 1,
}