chore: rescate y restauracion de modulos base, a76 y digitalizacion tras conflictos
This commit is contained in:
@@ -60,11 +60,17 @@ def list_expediente_archivos(
|
||||
page: int = Query(1, ge=1),
|
||||
page_size: int = Query(50, ge=1, le=200),
|
||||
search: str = Query(None),
|
||||
status: str = Query(None),
|
||||
rfc_consulta: str = Query(None),
|
||||
e_document: str = Query(None),
|
||||
db: Session = Depends(get_core_db),
|
||||
current_user: Dict[str, Any] = Depends(get_current_user),
|
||||
):
|
||||
tenant_id = validate_access_to_resource(db, company_id, current_user)
|
||||
return ExpedienteArchivoService.list(db, company_id, tenant_id, page, page_size, search)
|
||||
return ExpedienteArchivoService.list(
|
||||
db, company_id, tenant_id, page, page_size,
|
||||
search=search, status=status, rfc_consulta=rfc_consulta, e_document=e_document
|
||||
)
|
||||
|
||||
|
||||
@router.get("/{record_id}", response_model=ExpedienteArchivoResponseDTO)
|
||||
|
||||
@@ -75,6 +75,9 @@ class ExpedienteArchivoService:
|
||||
page: int = 1,
|
||||
page_size: int = 50,
|
||||
search: Optional[str] = None,
|
||||
status: Optional[str] = None,
|
||||
rfc_consulta: Optional[str] = None,
|
||||
e_document: Optional[str] = None,
|
||||
) -> ExpedienteArchivoListResponse:
|
||||
query = (
|
||||
db.query(ExpedienteArchivo)
|
||||
@@ -84,11 +87,22 @@ class ExpedienteArchivoService:
|
||||
ExpedienteArchivo.deleted_at.is_(None),
|
||||
)
|
||||
)
|
||||
if status:
|
||||
query = query.filter(ExpedienteArchivo.status == status)
|
||||
if rfc_consulta:
|
||||
query = query.filter(ExpedienteArchivo.rfc_consulta.ilike(f"%{rfc_consulta}%"))
|
||||
if e_document:
|
||||
query = query.filter(ExpedienteArchivo.e_document.ilike(f"%{e_document}%"))
|
||||
if search:
|
||||
like = f"%{search}%"
|
||||
query = query.filter(
|
||||
ExpedienteArchivo.e_document.ilike(like)
|
||||
| ExpedienteArchivo.tipo_documento.ilike(like)
|
||||
or_(
|
||||
ExpedienteArchivo.e_document.ilike(like),
|
||||
ExpedienteArchivo.tipo_documento.ilike(like),
|
||||
ExpedienteArchivo.rfc_consulta.ilike(like),
|
||||
ExpedienteArchivo.num_operacion.ilike(like),
|
||||
ExpedienteArchivo.nombre_archivo.ilike(like),
|
||||
)
|
||||
)
|
||||
total = query.count()
|
||||
items = query.order_by(ExpedienteArchivo.id.desc()).offset((page - 1) * page_size).limit(page_size).all()
|
||||
|
||||
@@ -82,7 +82,7 @@ async def export_doda_list(
|
||||
"""
|
||||
Listado al estilo legacy: filtra `doda_date` (YYYYMMDD) entre inicio y fin.
|
||||
"""
|
||||
tenant_id = int(validate_access_to_resource(db, company_id, current_user))
|
||||
tenant_id = int(validate_access_to_resource(db, company_id, current_user, ["cat_doda.view"]))
|
||||
try:
|
||||
d0, d1, fmt, mode = parse_export_params(
|
||||
date_from, date_to, file_format, date_mode
|
||||
@@ -126,7 +126,7 @@ async def export_doda_pedimentos(
|
||||
Reporte por DODA seleccionado: columnas alineadas al listado de pedimentos (PATENTE, DOCUMENTO, COVE, etc.).
|
||||
Si no hay líneas, se devuelve el archivo solo con encabezados.
|
||||
"""
|
||||
tenant_id = int(validate_access_to_resource(db, company_id, current_user))
|
||||
tenant_id = int(validate_access_to_resource(db, company_id, current_user, ["cat_doda.view"]))
|
||||
try:
|
||||
fmt = parse_pedimento_export_format(file_format)
|
||||
except ValueError as e:
|
||||
@@ -168,6 +168,11 @@ _crud_router = TenantCRUDRoutes(
|
||||
id_name="doda_id",
|
||||
enable_list=True,
|
||||
enable_filters=True,
|
||||
list_permissions=["cat_doda.view"],
|
||||
get_permissions=["cat_doda.view"],
|
||||
create_permissions=["cat_doda.create"],
|
||||
update_permissions=["cat_doda.edit"],
|
||||
delete_permissions=["cat_doda.delete"],
|
||||
).router
|
||||
router.include_router(_crud_router)
|
||||
|
||||
@@ -183,7 +188,7 @@ async def get_doda_detail(
|
||||
db: Session = Depends(get_core_db),
|
||||
current_user: dict = Depends(get_current_user),
|
||||
):
|
||||
tenant_id = validate_access_to_resource(db, company_id, current_user)
|
||||
tenant_id = validate_access_to_resource(db, company_id, current_user, ["cat_doda.view"])
|
||||
doda = DodaService.get_by_id(db, doda_id, tenant_id, company_id)
|
||||
if not doda:
|
||||
raise HTTPException(
|
||||
|
||||
@@ -28,6 +28,11 @@ router = TenantCRUDRoutes(
|
||||
resource_name="Electronic Notice",
|
||||
enable_list=True,
|
||||
enable_filters=True,
|
||||
list_permissions=["cat_notices.view"],
|
||||
get_permissions=["cat_notices.view"],
|
||||
create_permissions=["cat_notices.create"],
|
||||
update_permissions=["cat_notices.edit"],
|
||||
delete_permissions=["cat_notices.delete"],
|
||||
).router
|
||||
|
||||
|
||||
@@ -43,7 +48,7 @@ async def get_notices_by_pedimento(
|
||||
current_user: dict = Depends(get_current_user),
|
||||
):
|
||||
"""Get all electronic notices for a specific pedimento"""
|
||||
tenant_id = validate_access_to_resource(db, company_id, current_user)
|
||||
tenant_id = validate_access_to_resource(db, company_id, current_user, ["cat_notices.view"])
|
||||
notices = ElectronicNoticeService.get_by_pedimento(
|
||||
db, pedimento, tenant_id, company_id)
|
||||
return [ElectronicNoticeResponseDTO.model_validate(notice) for notice in notices]
|
||||
@@ -61,7 +66,7 @@ async def get_notices_by_status(
|
||||
current_user: dict = Depends(get_current_user),
|
||||
):
|
||||
"""Get all electronic notices with a specific status"""
|
||||
tenant_id = validate_access_to_resource(db, company_id, current_user)
|
||||
tenant_id = validate_access_to_resource(db, company_id, current_user, ["cat_notices.view"])
|
||||
notices = ElectronicNoticeService.get_by_status(
|
||||
db, status, tenant_id, company_id)
|
||||
return [ElectronicNoticeResponseDTO.model_validate(notice) for notice in notices]
|
||||
|
||||
Reference in New Issue
Block a user