57 lines
1.1 KiB
Go
57 lines
1.1 KiB
Go
package entity
|
|
|
|
import (
|
|
"gorm.io/gorm"
|
|
"leafdev.top/Leaf/leaf-library-3/internal/dto"
|
|
)
|
|
|
|
type Document struct {
|
|
Model
|
|
|
|
Name string `json:"name"`
|
|
|
|
WorkspaceId dto.EntityId `json:"workspace_id"`
|
|
Workspace *Workspace `json:"workspace"`
|
|
|
|
CollectionId dto.EntityId `json:"collection_id"`
|
|
Collection *Collection `json:"collection"`
|
|
|
|
ParentId *dto.EntityId `json:"parent_id"`
|
|
Parent *Document `json:"parent"`
|
|
|
|
DeletedAt gorm.DeletedAt `json:"deleted_at"`
|
|
}
|
|
|
|
func (*Document) TableName() string {
|
|
return "documents"
|
|
}
|
|
|
|
type DocumentBlock struct {
|
|
Model
|
|
|
|
DocumentId dto.EntityId `json:"document_id"`
|
|
Document *Document `json:"document"`
|
|
|
|
Type string `json:"type"`
|
|
Content string `json:"content"`
|
|
Hash string `json:"hash"`
|
|
Order float64 `json:"order" gorm:"index"`
|
|
}
|
|
|
|
func (*DocumentBlock) TableName() string {
|
|
return "document_blocks"
|
|
}
|
|
|
|
type BlockChunk struct {
|
|
Model
|
|
|
|
DocumentBlockId dto.EntityId `json:"document_block_id"`
|
|
DocumentBlock *DocumentBlock `json:"document_block"`
|
|
|
|
Content string `json:"content"`
|
|
}
|
|
|
|
func (*BlockChunk) TableName() string {
|
|
return "block_chunks"
|
|
}
|