merge: Phase 1 image system implementation complete
- Database: Added photo_path, photo_thumbnail_path, photo_upload_date fields
- Services: ImageStorage (file ops) + ImageProcessor (image processing pipeline)
- API: POST/PUT /api/items/{id}/photo upload endpoints with validation
- API: GET /api/items/{id} returns photo URLs
- Static: FastAPI StaticFiles mount for /images/ directory
- Tests: 127+ comprehensive tests across all components
- Security: Fixed race conditions, path traversal, crop validation
- Ready for Phase 2 (frontend UI)
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -22,6 +22,7 @@ from .items import (
|
||||
ColorBase,
|
||||
ColorCreate,
|
||||
Color,
|
||||
PhotoResponse,
|
||||
ItemBase,
|
||||
ItemCreate,
|
||||
Item,
|
||||
@@ -57,6 +58,7 @@ __all__ = [
|
||||
"ColorBase",
|
||||
"ColorCreate",
|
||||
"Color",
|
||||
"PhotoResponse",
|
||||
"ItemBase",
|
||||
"ItemCreate",
|
||||
"Item",
|
||||
|
||||
@@ -3,6 +3,14 @@ from typing import Optional
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
# --- Photo Response ---
|
||||
class PhotoResponse(BaseModel):
|
||||
"""Photo metadata for item responses."""
|
||||
thumbnail_url: str
|
||||
full_url: str
|
||||
uploaded_at: datetime
|
||||
|
||||
|
||||
# --- Categories ---
|
||||
class CategoryBase(BaseModel):
|
||||
name: str
|
||||
@@ -66,6 +74,10 @@ class ItemCreate(ItemBase):
|
||||
|
||||
class Item(ItemBase):
|
||||
id: int
|
||||
photo_path: Optional[str] = None
|
||||
photo_thumbnail_path: Optional[str] = None
|
||||
photo_upload_date: Optional[datetime] = None
|
||||
photo: Optional[PhotoResponse] = None
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
Reference in New Issue
Block a user