Skip to content

Commit

Permalink
[Docs] [sites] Add summary and description to sites routes (#38)
Browse files Browse the repository at this point in the history
* docs: add first draft of summary and description for sites route

* docs: rewording

* style: Apply D212 to be codacy compliant

* docs: Remove arguments description in post route
  • Loading branch information
fe51 authored Nov 17, 2020
1 parent a36d5ae commit aaecd67
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions src/app/api/routes/sites.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,43 @@
router = APIRouter()


@router.post("/", response_model=SiteOut, status_code=201)
@router.post("/", response_model=SiteOut, status_code=201, summary="Create a new site")
async def create_site(payload: SiteIn):
"""Creates a new site based on the given information
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(sites, payload)


@router.get("/{site_id}/", response_model=SiteOut)
@router.get("/{site_id}/", response_model=SiteOut, summary="Get information about a specific site")
async def get_site(site_id: int = Path(..., gt=0)):
"""
Based on a site_id, retrieves information about the given site
"""
return await crud.get_entry(sites, site_id)


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


@router.put("/{site_id}/", response_model=SiteOut)
@router.put("/{site_id}/", response_model=SiteOut, summary="Update information about a specific site")
async def update_site(payload: SiteIn, site_id: int = Path(..., gt=0)):
"""
Based on a site_id, updates information about the given site
"""
return await crud.update_entry(sites, payload, site_id)


@router.delete("/{site_id}/", response_model=SiteOut)
@router.delete("/{site_id}/", response_model=SiteOut, summary="Delete a specific site")
async def delete_site(site_id: int = Path(..., gt=0)):
"""
Based on a site_id, deletes the given site
"""
return await crud.delete_entry(sites, site_id)

0 comments on commit aaecd67

Please sign in to comment.