Initial commit
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
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
|
||||
Reference in New Issue
Block a user