set up for deployment

This commit is contained in:
M1ngdaXie
2026-01-12 00:16:55 -08:00
parent 6b1ed8d11c
commit 819760662a
26 changed files with 568 additions and 13 deletions

View File

@@ -0,0 +1,44 @@
package models
import (
"time"
"github.com/google/uuid"
)
// DocumentVersion represents a snapshot of a document at a point in time
type DocumentVersion struct {
ID uuid.UUID `json:"id"`
DocumentID uuid.UUID `json:"document_id"`
YjsSnapshot []byte `json:"-"` // Omit from JSON (binary)
TextPreview *string `json:"text_preview"` // Full plain text
VersionNumber int `json:"version_number"`
CreatedBy *uuid.UUID `json:"created_by"`
VersionLabel *string `json:"version_label"`
IsAutoGenerated bool `json:"is_auto_generated"`
CreatedAt time.Time `json:"created_at"`
}
// DocumentVersionWithAuthor includes author information
type DocumentVersionWithAuthor struct {
DocumentVersion
Author *User `json:"author,omitempty"` // Nullable if user deleted
}
// CreateVersionRequest is the API request for manual snapshots
type CreateVersionRequest struct {
VersionLabel *string `json:"version_label"` // Optional user label
TextPreview *string `json:"text_preview"` // Frontend-generated full text
// YjsSnapshot sent as multipart file, not JSON
}
// RestoreVersionRequest specifies which version to restore
type RestoreVersionRequest struct {
VersionID uuid.UUID `json:"version_id" binding:"required"`
}
// VersionListResponse for listing versions
type VersionListResponse struct {
Versions []DocumentVersionWithAuthor `json:"versions"`
Total int `json:"total"`
}