Files
2026-11-05 08:28:15 +00:00

28 lines
693 B
Python

from fastapi import APIRouter, UploadFile, File, HTTPException
ALLOWED_IMAGES = {
"image/jpeg",
"image/png",
"image/webp",
}
routes = APIRouter(prefix="/animals/{animalId}/images", tags=['Animal image'])
@routes.get("")
def ListAnimalImages(animalId: str):
pass
@routes.post("")
def RegisterAnimalImage(animalId: str, file: UploadFile = File(...)):
if file.content_type not in ALLOWED_IMAGES:
raise HTTPException(status_code=400, detail="File must be an image")
return {"data": file.filename}
@routes.put("/{id}")
def EditAnimalImage(animalId: str, id: str, data):
pass
@routes.delete("/{id}")
def DisableAnimalImage(animalId: str, id: str):
pass