refactor(documents): rename document tree model
This commit is contained in:
@@ -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))),
|
||||
|
||||
Reference in New Issue
Block a user