feat(files): add source-file upload with MinIO storage and Postgres repositories
Why: - Implements plan 001 Phase 3's upload orchestration. Changes: - ObjectStorage port and MinIO adapter, thread-offloaded per ADR-0017. - Tenant-scoped repositories for api_keys, source_files, ingestion_jobs. - upload_source_file implementing the two-transaction shape with (tenant_id, domain, content_sha256) idempotency. Impact: - This phase stores bytes only -- chunks_indexed is always 0 until Phase 4/5 add parsing/embedding.
This commit is contained in:
26
src/application/files/models.py
Normal file
26
src/application/files/models.py
Normal file
@@ -0,0 +1,26 @@
|
||||
"""Domain models for the upload use case (ADR-0008, ADR-0009)."""
|
||||
|
||||
import uuid
|
||||
from dataclasses import dataclass
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class ValidatedUpload:
|
||||
"""The result of extension/content validation, before any I/O."""
|
||||
|
||||
source_type: str
|
||||
content_type: str
|
||||
content_sha256: str
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class UploadResult:
|
||||
"""What `upload_source_file` returns; the route maps this to `FileUploadResponse`."""
|
||||
|
||||
file_id: uuid.UUID
|
||||
ingestion_job_id: uuid.UUID
|
||||
status: str
|
||||
chunks_indexed: int
|
||||
is_new_attempt: bool
|
||||
"""`False` when an identical active upload already succeeded and no new
|
||||
ingestion attempt was made (route returns `200`, not `201`)."""
|
||||
Reference in New Issue
Block a user