Spaces:
Sleeping
Sleeping
Download controller/cidade_controller.py from pdrMottaS/afabd-ts02: direct link, hf CLI and curl.
- Browser
- Download file 747 Bytes
-
https://huggingface.co/spaces/pdrMottaS/afabd-ts02/resolve/main/controller/cidade_controller.py
- Command line
-
hf download hf://spaces/pdrMottaS/afabd-ts02/controller/cidade_controller.py
-
curl -L -o cidade_controller.py https://huggingface.co/spaces/pdrMottaS/afabd-ts02/resolve/main/controller/cidade_controller.py
747 Bytes
| from fastapi import APIRouter, Depends | |
| from schema import ResponseCidade,RequestCidade | |
| from model import Login | |
| from service import CidadeService,SessionService | |
| from typing import List, Annotated | |
| router = APIRouter( | |
| prefix='/cidade' | |
| ) | |
| service = SessionService() | |
| async def list_cidade(regiao_id:int,user: Annotated[Login,Depends(service.validate_token)]): | |
| cidade_service = CidadeService() | |
| return cidade_service.list_cidade(regiao_id) | |
| async def create_cidade(cidade:RequestCidade,user: Annotated[Login,Depends(service.validate_token)]): | |
| cidade_service = CidadeService() | |
| return cidade_service.create_cidade(cidade) | |