feat(shopping): photo par article dans le catalogue
- Upload photo (context=product → thumbnail 150×150) dans CatalogueModal - Miniature affichée dans la liste et dans le formulaire - Schémas ProductCreate/Update/Response exposent image_path + thumbnail_path - Backend sert /media/* via StaticFiles (FastAPI) - Proxy /media → backend dans vite.config et nginx.conf Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from contextlib import asynccontextmanager
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from app.api.health import router as health_router
|
||||
from app.api.media import router as media_router
|
||||
from app.api.todos import router as todos_router
|
||||
@@ -29,3 +30,5 @@ app.include_router(health_router, prefix="/api")
|
||||
app.include_router(media_router, prefix="/api/media")
|
||||
app.include_router(todos_router, prefix="/api/todos")
|
||||
app.include_router(shopping_router, prefix="/api/shopping")
|
||||
|
||||
app.mount("/media", StaticFiles(directory=str(settings.upload_path)), name="media")
|
||||
|
||||
@@ -38,6 +38,8 @@ class ProductCreate(BaseModel):
|
||||
price: Decimal | None = None
|
||||
quantity_per_unit: Decimal | None = None
|
||||
default_store_id: uuid.UUID | None = None
|
||||
image_path: str | None = None
|
||||
thumbnail_path: str | None = None
|
||||
|
||||
|
||||
class ProductUpdate(BaseModel):
|
||||
@@ -50,6 +52,8 @@ class ProductUpdate(BaseModel):
|
||||
price: Decimal | None = None
|
||||
quantity_per_unit: Decimal | None = None
|
||||
default_store_id: uuid.UUID | None = None
|
||||
image_path: str | None = None
|
||||
thumbnail_path: str | None = None
|
||||
|
||||
|
||||
class ProductResponse(BaseModel):
|
||||
@@ -65,6 +69,8 @@ class ProductResponse(BaseModel):
|
||||
quantity_per_unit: Decimal | None
|
||||
default_store_id: uuid.UUID | None
|
||||
frequency_score: int
|
||||
image_path: str | None
|
||||
thumbnail_path: str | None
|
||||
|
||||
|
||||
class ListItemCreate(BaseModel):
|
||||
|
||||
Reference in New Issue
Block a user