Automated Action 2bc28761f5 Create file upload and download API
- Set up FastAPI project structure
- Implement database models and migrations for file metadata
- Create file upload endpoint with size validation
- Implement file download and listing functionality
- Add health check and API information endpoints
- Create comprehensive documentation
2025-06-09 13:33:57 +00:00

42 lines
767 B
Python

from datetime import datetime
from pydantic import BaseModel
class FileBase(BaseModel):
"""Base schema for File with common attributes."""
filename: str
content_type: str
file_size: int
class FileCreate(FileBase):
"""Schema for creating a file (internal use)."""
original_filename: str
file_path: str
class FileInDB(FileBase):
"""Schema for file as stored in the database."""
id: int
original_filename: str
created_at: datetime
updated_at: datetime
class Config:
orm_mode = True
class FileResponse(FileBase):
"""Schema for file response returned to clients."""
id: int
original_filename: str
created_at: datetime
download_url: str
class Config:
orm_mode = True