Skip to content

Commit

Permalink
[docs][media] Add summary and description to media routes (#41)
Browse files Browse the repository at this point in the history
* docs: Add summary and description to media routes

* docs: correct spelling mistake
  • Loading branch information
fe51 authored Nov 17, 2020
1 parent aaecd67 commit 3bb950c
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions src/app/api/routes/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,44 @@
router = APIRouter()


@router.post("/", response_model=MediaOut, status_code=201)
@router.post("/", response_model=MediaOut, status_code=201, summary="Create a media related to a specific device")
async def create_media(payload: MediaIn):
"""
Creates a media related to specific device, based on device_id as argument
Below, click on "Schema" for more detailed information about arguments
or "Example Value" to get a concrete idea of arguments
"""
return await crud.create_entry(media, payload)


@router.get("/{media_id}/", response_model=MediaOut)
@router.get("/{media_id}/", response_model=MediaOut, summary="Get information about a specific media")
async def get_media(media_id: int = Path(..., gt=0)):
"""
Based on a media_id, retrieves information about the given media
"""
return await crud.get_entry(media, media_id)


@router.get("/", response_model=List[MediaOut])
@router.get("/", response_model=List[MediaOut], summary="Get the list of all media")
async def fetch_media():
"""
Retrieves the list of all media with each related information
"""
return await crud.fetch_all(media)


@router.put("/{media_id}/", response_model=MediaOut)
@router.put("/{media_id}/", response_model=MediaOut, summary="Update information about a specific media")
async def update_media(payload: MediaIn, media_id: int = Path(..., gt=0)):
"""
Based on a media_id, updates information about the given media
"""
return await crud.update_entry(media, payload, media_id)


@router.delete("/{media_id}/", response_model=MediaOut)
@router.delete("/{media_id}/", response_model=MediaOut, summary="Delete a specific media")
async def delete_media(media_id: int = Path(..., gt=0)):
"""
Based on a media_id, deletes the given media
"""
return await crud.delete_entry(media, media_id)

0 comments on commit 3bb950c

Please sign in to comment.