ebf47c6013
track file sizes for all documents in system * feature complete needs dev testing
74 lines
1.7 KiB
Go
74 lines
1.7 KiB
Go
package document
|
|
|
|
import (
|
|
"time"
|
|
|
|
"queryorchestration/internal/serviceconfig"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// DocumentSummary contains minimal document identification info.
|
|
type DocumentSummary struct {
|
|
ID uuid.UUID
|
|
ClientID string
|
|
Hash string
|
|
}
|
|
|
|
// DocumentExternal contains document info with computed fields for external API responses.
|
|
type DocumentExternal struct {
|
|
Id uuid.UUID
|
|
ClientID string
|
|
Hash string
|
|
Fields map[string]interface{}
|
|
}
|
|
|
|
// DocumentEnriched contains full document details including metadata, labels, and optionally text record.
|
|
// Used by GET /document/{id} endpoint.
|
|
type DocumentEnriched struct {
|
|
ID uuid.UUID
|
|
ClientID string
|
|
Hash string
|
|
Fields map[string]interface{}
|
|
HasTextRecord bool
|
|
FolderID *uuid.UUID
|
|
Filename *string
|
|
OriginalPath *string
|
|
Labels []LabelRecord
|
|
TextRecord *TextRecord // Only populated when includeTextRecord=true
|
|
FileSizeBytes *int64 // File size in bytes (nil for legacy documents)
|
|
}
|
|
|
|
// LabelRecord represents a label applied to a document.
|
|
type LabelRecord struct {
|
|
ID uuid.UUID
|
|
DocumentID uuid.UUID
|
|
Label string
|
|
AppliedBy string
|
|
AppliedAt time.Time
|
|
}
|
|
|
|
// TextRecord represents the field extraction response for a document.
|
|
// This mirrors the FieldExtractionResponse from the API.
|
|
type TextRecord struct {
|
|
ID uuid.UUID
|
|
DocumentID uuid.UUID
|
|
Version int32
|
|
SingleFields interface{}
|
|
ArrayFields interface{}
|
|
CreatedAt time.Time
|
|
CreatedBy string
|
|
}
|
|
|
|
// Service provides document-related operations.
|
|
type Service struct {
|
|
cfg serviceconfig.ConfigProvider
|
|
}
|
|
|
|
// New creates a new Document service instance.
|
|
func New(cfg serviceconfig.ConfigProvider) *Service {
|
|
return &Service{
|
|
cfg,
|
|
}
|
|
}
|