hako/internal/model/archival.go

70 lines
1.9 KiB
Go

package model
import (
"time"
)
// ArchiveStatus represents the status of an archive operation
type ArchiveStatus string
const (
ArchiveStatusPending ArchiveStatus = "pending"
ArchiveStatusProcessing ArchiveStatus = "processing"
ArchiveStatusCompleted ArchiveStatus = "completed"
ArchiveStatusFailed ArchiveStatus = "failed"
ArchiveStatusPartial ArchiveStatus = "partial"
)
// Link represents a URL that has been archived or is being archived
type Link struct {
ID string `json:"id"`
URL string `json:"url"`
UserID string `json:"user_id"`
TotalSize int64 `json:"total_size,omitempty"` // Total size of all archived files in bytes (denormalized)
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// Archive represents a single archival operation for a link
type Archive struct {
ID string
LinkID string
UserID string
Status ArchiveStatus
Title string
ErrorMessage string
CreatedAt time.Time
CompletedAt *time.Time
}
// ArchiveFile represents a file that was archived
type ArchiveFile struct {
ID string
ArchiveID string
ArchiverKey string
Filename string
MimeType string
FileSize int64
StoragePath string
HashSha256 string
Content string // Extracted text content for full-text search
ContentMimeType string // MIME type of the extracted content (e.g., "text/markdown", "text/plain")
ThumbnailPath string // Path to thumbnail image (optional)
CreatedAt time.Time
}
// ArchiverConfig represents configuration for an archiver
type ArchiverConfig struct {
ArchiverKey string
ConfigJSON string
UpdatedAt time.Time
}
// Category represents a content category for links
type Category struct {
ID string
Name string
Icon string
CreatedAt time.Time
UpdatedAt time.Time
}