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:
47
backend/app/api/v1/video.py
Normal file
47
backend/app/api/v1/video.py
Normal file
@@ -0,0 +1,47 @@
|
||||
"""Endpoints para gestión de video."""
|
||||
|
||||
from typing import List, Optional
|
||||
from fastapi import APIRouter, Depends, Query
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.core.database import get_db
|
||||
from app.core.security import get_current_user
|
||||
from app.models.usuario import Usuario
|
||||
from app.models.camara import Camara
|
||||
|
||||
router = APIRouter(prefix="/video", tags=["Video"])
|
||||
|
||||
|
||||
@router.get("/camaras")
|
||||
async def listar_camaras(
|
||||
vehiculo_id: Optional[int] = None,
|
||||
activa: Optional[bool] = True,
|
||||
db: AsyncSession = Depends(get_db),
|
||||
current_user: Usuario = Depends(get_current_user),
|
||||
):
|
||||
"""Lista las cámaras."""
|
||||
query = select(Camara)
|
||||
if vehiculo_id:
|
||||
query = query.where(Camara.vehiculo_id == vehiculo_id)
|
||||
if activa is not None:
|
||||
query = query.where(Camara.activa == activa)
|
||||
result = await db.execute(query)
|
||||
camaras = result.scalars().all()
|
||||
return [{"id": c.id, "vehiculo_id": c.vehiculo_id, "nombre": c.nombre,
|
||||
"tipo": c.tipo, "url_stream": c.url_stream, "activa": c.activa} for c in camaras]
|
||||
|
||||
|
||||
@router.get("/camaras/{camara_id}")
|
||||
async def obtener_camara(
|
||||
camara_id: int,
|
||||
db: AsyncSession = Depends(get_db),
|
||||
current_user: Usuario = Depends(get_current_user),
|
||||
):
|
||||
"""Obtiene una cámara por ID."""
|
||||
result = await db.execute(select(Camara).where(Camara.id == camara_id))
|
||||
camara = result.scalar_one_or_none()
|
||||
if not camara:
|
||||
return {"detail": "Cámara no encontrada"}
|
||||
return {"id": camara.id, "vehiculo_id": camara.vehiculo_id, "nombre": camara.nombre,
|
||||
"tipo": camara.tipo, "url_stream": camara.url_stream}
|
||||
Reference in New Issue
Block a user