Skip to content

Commit

Permalink
Merge pull request #25 from guivaloz:guivaloz/mejores-rutas
Browse files Browse the repository at this point in the history
Mejoras en rutas
  • Loading branch information
guivaloz authored Jun 24, 2024
2 parents f45a742 + f1790b5 commit 6e28a7c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 55 deletions.
4 changes: 2 additions & 2 deletions carina/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ def create_app() -> FastAPI:
app.include_router(distritos, include_in_schema=False)
app.include_router(domicilios, include_in_schema=False)
app.include_router(entradas_salidas, include_in_schema=False)
app.include_router(estados)
app.include_router(estados, include_in_schema=False)
app.include_router(exh_areas, include_in_schema=False)
app.include_router(exh_exhortos)
app.include_router(exh_exhortos_archivos)
app.include_router(exh_exhortos_partes, include_in_schema=False)
app.include_router(materias)
app.include_router(modulos, include_in_schema=False)
app.include_router(municipios)
app.include_router(municipios, include_in_schema=False)
app.include_router(oficinas, include_in_schema=False)
app.include_router(permisos, include_in_schema=False)
app.include_router(roles, include_in_schema=False)
Expand Down
4 changes: 2 additions & 2 deletions carina/v4/exh_exhortos/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@


@exh_exhortos.get("/{folio_seguimiento}", response_model=OneExhExhortoOut)
async def detalle_exh_exhorto_con_folio_seguimiento(
async def consultar_exhorto_request(
current_user: Annotated[UsuarioInDB, Depends(get_current_active_user)],
database: Annotated[Session, Depends(get_db)],
folio_seguimiento: str,
Expand Down Expand Up @@ -117,7 +117,7 @@ async def detalle_exh_exhorto_con_folio_seguimiento(


@exh_exhortos.post("", response_model=OneExhExhortoConfirmacionDatosExhortoRecibidoOut)
async def recepcion_exh_exhorto(
async def recibir_exhorto_request(
current_user: Annotated[UsuarioInDB, Depends(get_current_active_user)],
database: Annotated[Session, Depends(get_db)],
exh_exhorto: ExhExhortoIn,
Expand Down
35 changes: 2 additions & 33 deletions carina/v4/exh_exhortos_archivos/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,42 +28,11 @@
from lib.fastapi_pagination_custom_page import CustomPage
from lib.google_cloud_storage import upload_file_to_gcs

exh_exhortos_archivos = APIRouter(prefix="/v4/exh_exhortos_archivos", tags=["exhortos"])


@exh_exhortos_archivos.get("", response_model=CustomPage[ExhExhortoArchivoOut])
async def paginado_exh_exhortos_archivos(
current_user: Annotated[UsuarioInDB, Depends(get_current_active_user)],
database: Annotated[Session, Depends(get_db)],
):
"""Paginado de archivos de exhortos"""
if current_user.permissions.get("EXH EXHORTOS ARCHIVOS", 0) < Permiso.VER:
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail="Forbidden")
try:
resultados = get_exh_exhortos_archivos(database)
except MyAnyError as error:
return CustomPage(success=False, errors=[str(error)])
return paginate(resultados)


@exh_exhortos_archivos.get("/{exh_exhorto_archivo_id}", response_model=OneExhExhortoArchivoOut)
async def detalle_exh_exhorto_archivo(
current_user: Annotated[UsuarioInDB, Depends(get_current_active_user)],
database: Annotated[Session, Depends(get_db)],
exh_exhorto_archivo_id: int,
):
"""Detalle de una archivo a partir de su id"""
if current_user.permissions.get("EXH EXHORTOS ARCHIVOS", 0) < Permiso.VER:
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail="Forbidden")
try:
exh_exhorto_archivo = get_exh_exhorto_archivo(database, exh_exhorto_archivo_id)
except MyAnyError as error:
return OneExhExhortoArchivoOut(success=False, errors=[str(error)])
return OneExhExhortoArchivoOut(success=True, data=exh_exhorto_archivo)
exh_exhortos_archivos = APIRouter(prefix="/v4/exh_exhortos_archivos", tags=["exhortos archivos"])


@exh_exhortos_archivos.post("/upload")
async def upload_exh_exhorto_archivo(
async def recibir_exhorto_archivo_request(
current_user: Annotated[UsuarioInDB, Depends(get_current_active_user)],
database: Annotated[Session, Depends(get_db)],
exhortoOrigenId: str,
Expand Down
20 changes: 2 additions & 18 deletions carina/v4/materias/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@

from ...core.permisos.models import Permiso
from ..usuarios.authentications import UsuarioInDB, get_current_active_user
from .crud import get_materias, get_materia_with_clave
from .crud import get_materia_with_clave, get_materias
from .schemas import MateriaOut, OneMateriaOut

materias = APIRouter(prefix="/v4/materias", tags=["materias"])


@materias.get("", response_model=CustomList[MateriaOut])
async def paginado_materias(
async def consultar_materias_response(
current_user: Annotated[UsuarioInDB, Depends(get_current_active_user)],
database: Annotated[Session, Depends(get_db)],
):
Expand All @@ -32,19 +32,3 @@ async def paginado_materias(
except MyAnyError as error:
return CustomList(success=False, errors=[str(error)])
return paginate(resultados)


@materias.get("/{materia_clave}", response_model=OneMateriaOut)
async def detalle_materia(
current_user: Annotated[UsuarioInDB, Depends(get_current_active_user)],
database: Annotated[Session, Depends(get_db)],
materia_clave: str,
):
"""Detalle de una materia a partir de su clave"""
if current_user.permissions.get("MATERIAS", 0) < Permiso.VER:
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail="Forbidden")
try:
materia = get_materia_with_clave(database, materia_clave)
except MyAnyError as error:
return OneMateriaOut(success=False, errors=[str(error)])
return OneMateriaOut(success=True, data=materia)

0 comments on commit 6e28a7c

Please sign in to comment.