diff --git a/extensions/albums.py b/extensions/albums.py index 7a80576..a3281b1 100644 --- a/extensions/albums.py +++ b/extensions/albums.py @@ -13,7 +13,7 @@ from fastapi import HTTPException, Security from fastapi.responses import UJSONResponse, Response from starlette.status import HTTP_204_NO_CONTENT, HTTP_404_NOT_FOUND, HTTP_406_NOT_ACCEPTABLE, HTTP_409_CONFLICT -@app.post("/albums", response_class=UJSONResponse, response_model=Album, description="Create album with name and title") +@app.post("/albums", description="Create album with name and title", response_class=UJSONResponse, response_model=Album) async def album_create(name: str, title: str, current_user: User = Security(get_current_active_user, scopes=["albums.write"])): if re.search(re.compile('^[a-z,0-9,_]*$'), name) is False: @@ -40,7 +40,7 @@ async def album_create(name: str, title: str, current_user: User = Security(get_ } ) -@app.get("/albums", response_model=SearchResults, description="Find album by name") +@app.get("/albums", description="Find album by name", response_model=SearchResults) async def album_find(q: str, current_user: User = Security(get_current_active_user, scopes=["albums.list"])): output = {"results": []} @@ -51,7 +51,7 @@ async def album_find(q: str, current_user: User = Security(get_current_active_us return UJSONResponse(output) -@app.patch("/albums/{id}", response_class=UJSONResponse, description="Modify album's name or title by id") # response_model=AlbumModified +@app.patch("/albums/{id}", description="Modify album's name or title by id", response_class=UJSONResponse, response_model=AlbumModified) async def album_patch(id: str, name: Union[str, None] = None, title: Union[str, None] = None, cover: Union[str, None] = None, current_user: User = Security(get_current_active_user, scopes=["albums.write"])): try: @@ -96,7 +96,7 @@ async def album_patch(id: str, name: Union[str, None] = None, title: Union[str, } ) -@app.put("/albums/{id}", response_class=UJSONResponse, description="Modify album's name and title by id") # response_model=AlbumModified +@app.put("/albums/{id}", description="Modify album's name and title by id", response_class=UJSONResponse, response_model=AlbumModified) async def album_put(id: str, name: str, title: str, cover: str, current_user: User = Security(get_current_active_user, scopes=["albums.write"])): try: @@ -134,7 +134,7 @@ async def album_put(id: str, name: str, title: str, cover: str, current_user: Us } ) -@app.delete("/album/{id}", response_class=UJSONResponse, description="Delete album by id") +@app.delete("/album/{id}", description="Delete album by id", response_class=UJSONResponse) async def album_delete(id: str, current_user: User = Security(get_current_active_user, scopes=["albums.write"])): try: diff --git a/extensions/photos.py b/extensions/photos.py index a8585d5..997a4a3 100644 --- a/extensions/photos.py +++ b/extensions/photos.py @@ -214,7 +214,7 @@ async def photo_delete(id: str, current_user: User = Security(get_current_active return Response(status_code=HTTP_204_NO_CONTENT) -@app.get("/albums/{album}/photos", response_class=UJSONResponse, response_model=SearchResults, description="Find a photo by filename") +@app.get("/albums/{album}/photos", description="Find a photo by filename", response_class=UJSONResponse, response_model=SearchResults) async def photo_find(album: str, q: Union[str, None] = None, caption: Union[str, None] = None, page: int = 1, page_size: int = 100, lat: Union[float, None] = None, lng: Union[float, None] = None, radius: Union[int, None] = None, current_user: User = Security(get_current_active_user, scopes=["photos.list"])): if col_albums.find_one( {"user": current_user.user, "name": album} ) is None: @@ -257,7 +257,7 @@ async def photo_find(album: str, q: Union[str, None] = None, caption: Union[str, return UJSONResponse(output) -@app.get("/albums/{album}/photos/token", response_class=UJSONResponse, response_model=SearchResults, description="Find a photo by token") +@app.get("/albums/{album}/photos/token", description="Find a photo by token", response_class=UJSONResponse, response_model=SearchResults) async def photo_find_token(token: str): found_record = col_tokens.find_one( {"token": token} )