feat: Complete ATLAS system installation and API fixes
## Backend Changes - Add new API endpoints: combustible, pois, mantenimiento, video, configuracion - Fix vehiculos endpoint to return paginated response with items array - Add /vehiculos/all endpoint for non-paginated list - Add /geocercas/all endpoint - Add /alertas/configuracion GET/PUT endpoints - Add /viajes/activos and /viajes/iniciar endpoints - Add /reportes/stats, /reportes/templates, /reportes/preview endpoints - Add /conductores/all and /conductores/disponibles endpoints - Update router.py to include all new modules ## Frontend Changes - Fix authentication token handling (snake_case vs camelCase) - Update vehiculosApi.listAll to use /vehiculos/all - Fix FuelGauge component usage in Combustible page - Fix chart component exports (named + default exports) - Update API client for proper token refresh ## Infrastructure - Rename services from ADAN to ATLAS - Configure Cloudflare tunnel for atlas.consultoria-as.com - Update systemd service files - Configure PostgreSQL with TimescaleDB - Configure Redis, Mosquitto, Traccar, MediaMTX ## Documentation - Update installation guides - Update API reference - Rename all ADAN references to ATLAS Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -36,6 +36,58 @@ router = APIRouter(prefix="/alertas", tags=["Alertas"])
|
||||
# ============================================================================
|
||||
|
||||
|
||||
@router.get("/configuracion")
|
||||
async def obtener_configuracion_alertas(
|
||||
db: AsyncSession = Depends(get_db),
|
||||
current_user: Usuario = Depends(get_current_user),
|
||||
):
|
||||
"""Obtiene la configuración de alertas."""
|
||||
result = await db.execute(select(TipoAlerta).order_by(TipoAlerta.prioridad))
|
||||
tipos = result.scalars().all()
|
||||
return {
|
||||
"tipos": [
|
||||
{
|
||||
"id": t.id,
|
||||
"codigo": t.codigo,
|
||||
"nombre": t.nombre,
|
||||
"severidad_default": t.severidad_default,
|
||||
"activo": t.activo,
|
||||
"notificar_email": t.notificar_email,
|
||||
"notificar_push": t.notificar_push,
|
||||
"notificar_sms": t.notificar_sms,
|
||||
}
|
||||
for t in tipos
|
||||
],
|
||||
"notificaciones": {
|
||||
"email_habilitado": True,
|
||||
"push_habilitado": True,
|
||||
"sms_habilitado": False,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@router.put("/configuracion")
|
||||
async def actualizar_configuracion_alertas(
|
||||
data: dict,
|
||||
db: AsyncSession = Depends(get_db),
|
||||
current_user: Usuario = Depends(get_current_user),
|
||||
):
|
||||
"""Actualiza la configuración de alertas."""
|
||||
if "tipos" in data:
|
||||
for tipo_data in data["tipos"]:
|
||||
if "id" in tipo_data:
|
||||
result = await db.execute(
|
||||
select(TipoAlerta).where(TipoAlerta.id == tipo_data["id"])
|
||||
)
|
||||
tipo = result.scalar_one_or_none()
|
||||
if tipo:
|
||||
for field in ["activo", "notificar_email", "notificar_push", "notificar_sms"]:
|
||||
if field in tipo_data:
|
||||
setattr(tipo, field, tipo_data[field])
|
||||
await db.commit()
|
||||
return {"message": "Configuración actualizada"}
|
||||
|
||||
|
||||
@router.get("/tipos", response_model=List[TipoAlertaResponse])
|
||||
async def listar_tipos_alerta(
|
||||
activo: Optional[bool] = None,
|
||||
|
||||
Reference in New Issue
Block a user