refactor(documents): rename document tree model
This commit is contained in:
@@ -90,7 +90,7 @@ func TestDatasetAPIConnectsSourcesItemsAndSyncTasks(t *testing.T) {
|
||||
"projectId": project.Identity,
|
||||
})
|
||||
require.Equal(t, http.StatusCreated, deposited.Code)
|
||||
var depositedDocument models.SaDocument
|
||||
var depositedDocument models.SaDocumentTree
|
||||
require.NoError(t, database.Where("project_id = ?", project.ID).First(&depositedDocument).Error)
|
||||
require.Equal(t, item.Title+".md", depositedDocument.Name)
|
||||
var depositedContent models.SaDocumentContent
|
||||
@@ -241,7 +241,7 @@ func newDatasetTestDatabase(t *testing.T) *gorm.DB {
|
||||
&models.SaDatasetSource{},
|
||||
&models.SaDatasetItem{},
|
||||
&models.SaProject{},
|
||||
&models.SaDocument{},
|
||||
&models.SaDocumentTree{},
|
||||
&models.SaDocumentContent{},
|
||||
))
|
||||
return database
|
||||
|
||||
@@ -75,7 +75,7 @@ type ItemPatch struct {
|
||||
|
||||
type DepositResult struct {
|
||||
DocumentIdentity string
|
||||
ProjectIdentity string
|
||||
ProjectIdentity string
|
||||
}
|
||||
|
||||
type SourceRecord struct {
|
||||
@@ -363,9 +363,9 @@ func (s *Service) DepositItem(userID uint, itemIdentity, projectIdentity string)
|
||||
if !strings.HasSuffix(strings.ToLower(name), ".md") {
|
||||
name += ".md"
|
||||
}
|
||||
var document models.SaDocument
|
||||
var document models.SaDocumentTree
|
||||
err = s.db.Transaction(func(tx *gorm.DB) error {
|
||||
document = models.SaDocument{
|
||||
document = models.SaDocumentTree{
|
||||
ProjectID: project.ID, CreatedBy: userID, Kind: models.DocumentKindFile,
|
||||
Name: name, NormalizedName: strings.ToLower(name), Extension: ".md",
|
||||
MimeType: "text/markdown; charset=utf-8", Size: int64(len([]byte(body))),
|
||||
|
||||
Reference in New Issue
Block a user