- Backend (FastAPI): - Attachment and AttachmentVersion models with migration - FileStorageService with SHA-256 checksum validation - File type validation (whitelist/blacklist) - Full CRUD API with version control support - Audit trail integration for upload/download/delete - Configurable upload directory and file size limit - Frontend (React + Vite): - AttachmentUpload component with drag & drop - AttachmentList component with download/delete - TaskAttachments combined component - Attachments service for API calls - Testing: - 12 tests for storage service and API endpoints - OpenSpec: - add-document-management change archived 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
51 lines
1.1 KiB
Python
51 lines
1.1 KiB
Python
from pydantic import BaseModel
|
|
from typing import Optional, List
|
|
from datetime import datetime
|
|
|
|
|
|
class AttachmentVersionResponse(BaseModel):
|
|
id: str
|
|
version: int
|
|
file_size: int
|
|
checksum: str
|
|
uploaded_by: Optional[str] = None
|
|
uploader_name: Optional[str] = None
|
|
created_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class AttachmentResponse(BaseModel):
|
|
id: str
|
|
task_id: str
|
|
filename: str
|
|
original_filename: str
|
|
mime_type: str
|
|
file_size: int
|
|
current_version: int
|
|
is_encrypted: bool
|
|
uploaded_by: Optional[str] = None
|
|
uploader_name: Optional[str] = None
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class AttachmentListResponse(BaseModel):
|
|
attachments: List[AttachmentResponse]
|
|
total: int
|
|
|
|
|
|
class AttachmentDetailResponse(AttachmentResponse):
|
|
versions: List[AttachmentVersionResponse] = []
|
|
|
|
|
|
class VersionHistoryResponse(BaseModel):
|
|
attachment_id: str
|
|
filename: str
|
|
versions: List[AttachmentVersionResponse]
|
|
total: int
|