Fix route namings

This commit is contained in:
Yerassyl
2022-08-11 19:49:59 +06:00
committed by GitHub
parent 701d722be4
commit 573e27efaf

View File

@@ -108,12 +108,12 @@ async def valid_post_id(post_id: UUID4) -> Mapping:
# router.py # router.py
@router.get("/posts/{post_id}", response_model=PostResponse) @router.get("/posts/{post_id}", response_model=PostResponse)
async def get_post(post: Mapping = Depends(valid_post_id)): async def get_post_by_id(post: Mapping = Depends(valid_post_id)):
return post return post
@router.put("/posts/{post_id}", response_model=PostResponse) @router.put("/posts/{post_id}", response_model=PostResponse)
async def get_post( async def update_post(
update_data: PostUpdate, update_data: PostUpdate,
post: Mapping = Depends(valid_post_id), post: Mapping = Depends(valid_post_id),
): ):
@@ -122,7 +122,7 @@ async def get_post(
@router.get("/posts/{post_id}/reviews", response_model=list[ReviewsResponse]) @router.get("/posts/{post_id}/reviews", response_model=list[ReviewsResponse])
async def get_post(post: Mapping = Depends(valid_post_id)): async def get_post_reviews(post: Mapping = Depends(valid_post_id)):
post_reviews: list[Mapping] = await reviews_service.get_by_post_id(post["id"]) post_reviews: list[Mapping] = await reviews_service.get_by_post_id(post["id"])
return post_reviews return post_reviews
``` ```