diff --git a/requests/albums.py b/requests/albums.py index edb00eb..a2c7b47 100644 --- a/requests/albums.py +++ b/requests/albums.py @@ -13,7 +13,7 @@ from fastapi.responses import UJSONResponse, Response from fastapi.openapi.models import APIKey from starlette.status import HTTP_204_NO_CONTENT, HTTP_401_UNAUTHORIZED, HTTP_404_NOT_FOUND, HTTP_406_NOT_ACCEPTABLE, HTTP_409_CONFLICT -@app.post("/albums", response_class=UJSONResponse) +@app.post("/albums", response_class=UJSONResponse, description="Create album with name and title") async def album_create(name: str, title: str, apikey: APIKey = Depends(get_api_key)): if (check_project_key("photos", apikey)): @@ -45,7 +45,7 @@ async def album_create(name: str, title: str, apikey: APIKey = Depends(get_api_k else: raise HTTPException(status_code=HTTP_401_UNAUTHORIZED, detail=configGet("key_invalid", "messages")) -@app.get("/albums", response_class=UJSONResponse) +@app.get("/albums", response_class=UJSONResponse, description="Find album by name") async def album_find(q: str, apikey: APIKey = Depends(get_api_key)): if (check_project_key("photos", apikey)): @@ -61,7 +61,7 @@ async def album_find(q: str, apikey: APIKey = Depends(get_api_key)): else: raise HTTPException(status_code=HTTP_401_UNAUTHORIZED, detail=configGet("key_invalid", "messages")) -@app.patch("/albums/{id}", response_class=UJSONResponse) +@app.patch("/albums/{id}", response_class=UJSONResponse, description="Modify album's name or title by id") async def album_patch(id: str, name: Union[str, None] = None, title: Union[str, None] = None, apikey: APIKey = Depends(get_api_key)): if (check_project_key("photos", apikey)): @@ -101,7 +101,7 @@ async def album_patch(id: str, name: Union[str, None] = None, title: Union[str, else: raise HTTPException(status_code=HTTP_401_UNAUTHORIZED, detail=configGet("key_invalid", "messages")) -@app.put("/albums/{id}", response_class=UJSONResponse) +@app.put("/albums/{id}", response_class=UJSONResponse, description="Modify album's name and title by id") async def album_put(id: str, name: str, title: str, apikey: APIKey = Depends(get_api_key)): if (check_project_key("photos", apikey)): @@ -137,7 +137,7 @@ async def album_put(id: str, name: str, title: str, apikey: APIKey = Depends(get else: raise HTTPException(status_code=HTTP_401_UNAUTHORIZED, detail=configGet("key_invalid", "messages")) -@app.delete("/album/{id}", response_class=UJSONResponse) +@app.delete("/album/{id}", response_class=UJSONResponse, description="Delete album by id") async def album_delete(id: str, apikey: APIKey = Depends(get_api_key)): if (check_project_key("photos", apikey)): diff --git a/requests/photos.py b/requests/photos.py index cdb6126..d3fe614 100644 --- a/requests/photos.py +++ b/requests/photos.py @@ -15,7 +15,7 @@ from fastapi.responses import UJSONResponse, Response from fastapi.openapi.models import APIKey from starlette.status import HTTP_204_NO_CONTENT, HTTP_400_BAD_REQUEST, HTTP_401_UNAUTHORIZED, HTTP_404_NOT_FOUND, HTTP_406_NOT_ACCEPTABLE, HTTP_409_CONFLICT -@app.post("/albums/{album}/photos", response_class=UJSONResponse) +@app.post("/albums/{album}/photos", response_class=UJSONResponse, description="Upload a photo to album") async def photo_upload(file: UploadFile, album: str, ignore_duplicates: bool = False, apikey: APIKey = Depends(get_api_key)): if (check_project_key("photos", apikey)): @@ -64,7 +64,7 @@ async def photo_upload(file: UploadFile, album: str, ignore_duplicates: bool = F else: raise HTTPException(status_code=HTTP_401_UNAUTHORIZED, detail=configGet("key_invalid", "messages")) -@app.get("/photos/{id}") +@app.get("/photos/{id}", description="Get a photo by id") async def photo_get(id: str, apikey: APIKey = Depends(get_api_key)): if (check_project_key("photos", apikey)): @@ -87,7 +87,7 @@ async def photo_get(id: str, apikey: APIKey = Depends(get_api_key)): else: raise HTTPException(status_code=HTTP_401_UNAUTHORIZED, detail=configGet("key_invalid", "messages")) -@app.delete("/photos/{id}") +@app.delete("/photos/{id}", description="Delete a photo by id") async def photo_delete(id: str, apikey: APIKey = Depends(get_api_key)): if (check_project_key("photos", apikey)): @@ -106,7 +106,7 @@ async def photo_delete(id: str, apikey: APIKey = Depends(get_api_key)): else: raise HTTPException(status_code=HTTP_401_UNAUTHORIZED, detail=configGet("key_invalid", "messages")) -@app.get("/albums/{album}/photos", response_class=UJSONResponse) +@app.get("/albums/{album}/photos", response_class=UJSONResponse, description="Find a photo by filename") async def photo_find(q: str, album: str, page: int = 1, page_size: int = 100, apikey: APIKey = Depends(get_api_key)): if (check_project_key("photos", apikey)): @@ -134,7 +134,7 @@ async def photo_find(q: str, album: str, page: int = 1, page_size: int = 100, ap else: raise HTTPException(status_code=HTTP_401_UNAUTHORIZED, detail=configGet("key_invalid", "messages")) -@app.get("/photos/token/{token}", response_class=UJSONResponse) +@app.get("/photos/token/{token}", response_class=UJSONResponse, description="Find a photo by token") async def photo_find_token(token: str): found_record = col_tokens.find_one( {"token": token} )