first commit
This commit is contained in:
38
backend/internal/models/document.go
Normal file
38
backend/internal/models/document.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type DocumentType string
|
||||
|
||||
const (
|
||||
DocumentTypeEditor DocumentType = "editor"
|
||||
DocumentTypeKanban DocumentType = "kanban"
|
||||
)
|
||||
|
||||
type Document struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Type DocumentType `json:"type"`
|
||||
YjsState []byte `json:"-"` // Don't expose binary data in JSON
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
type CreateDocumentRequest struct {
|
||||
Name string `json:"name" binding:"required"`
|
||||
Type DocumentType `json:"type" binding:"required"`
|
||||
}
|
||||
|
||||
type UpdateStateRequest struct {
|
||||
State []byte `json:"state" binding:"required"`
|
||||
}
|
||||
|
||||
type DocumentListResponse struct {
|
||||
Documents []Document `json:"documents"`
|
||||
Total int `json:"total"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user