Files
query-orchestration/internal/document/service.go
T
Jay Brown ebf47c6013 Merged in feature/track-filesize (pull request #200)
track file sizes for all documents in system

* feature complete

needs dev testing
2026-01-12 17:46:07 +00:00

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,
}
}