refactor(documents): rename document tree model
This commit is contained in:
42
backend/internal/models/document_tree.go
Normal file
42
backend/internal/models/document_tree.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const (
|
||||
DocumentKindFolder = "folder"
|
||||
DocumentKindFile = "file"
|
||||
)
|
||||
|
||||
type SaDocumentTree struct {
|
||||
ID uint `gorm:"primaryKey"`
|
||||
Identity string `gorm:"type:char(36);uniqueIndex"`
|
||||
ProjectID uint `gorm:"index;not null;uniqueIndex:uidx_sa_document_sibling,priority:1"`
|
||||
ProjectIdentity string `gorm:"type:char(36);index"`
|
||||
ParentID *uint `gorm:"index"`
|
||||
ParentIdentity *string `gorm:"type:char(36);index"`
|
||||
ParentScope string `gorm:"type:char(36);not null;default:'';uniqueIndex:uidx_sa_document_sibling,priority:2"`
|
||||
CreatedBy uint `gorm:"index;not null"`
|
||||
CreatedByIdentity string `gorm:"type:char(36);index"`
|
||||
SourceInboxItemID *uint `gorm:"index"`
|
||||
SourceInboxItemIdentity *string `gorm:"type:char(36);index"`
|
||||
Kind string `gorm:"size:16;not null"`
|
||||
Name string `gorm:"not null"`
|
||||
NormalizedName string `gorm:"not null;uniqueIndex:uidx_sa_document_sibling,priority:3"`
|
||||
Extension string `gorm:"size:32"`
|
||||
MimeType string `gorm:"size:255"`
|
||||
Size int64 `gorm:"not null;default:0"`
|
||||
Revision uint64 `gorm:"not null;default:1"`
|
||||
SortOrder int `gorm:"not null;default:0"`
|
||||
ScanStatus string `gorm:"size:24;not null;default:'not_scanned'"`
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
DeletedAt gorm.DeletedAt `gorm:"index"`
|
||||
}
|
||||
|
||||
func (SaDocumentTree) TableName() string {
|
||||
return "sa_documents"
|
||||
}
|
||||
Reference in New Issue
Block a user