feat(14-01): add site_id device filter, wireless data endpoints, and frontend API clients

- Add site_id and sector_id query parameters to devices list endpoint
- Add get_device_registrations and get_device_rf_stats to link_service
- Add RegistrationResponse, RFStatsResponse schemas to link.py
- Add /registrations and /rf-stats endpoints to links router
- Add sectorsApi frontend client (list, create, update, delete, assignDevice)
- Add wirelessApi frontend client (links, registrations, RF stats, unknown clients)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jason Staack
2026-03-19 06:42:08 -05:00
parent ea5afe3408
commit 430cab98a8
6 changed files with 360 additions and 1 deletions

View File

@@ -18,7 +18,12 @@ from sqlalchemy.ext.asyncio import AsyncSession
from app.database import get_db
from app.middleware.tenant_context import CurrentUser, get_current_user
from app.routers.devices import _check_tenant_access
from app.schemas.link import LinkListResponse, UnknownClientListResponse
from app.schemas.link import (
LinkListResponse,
RegistrationListResponse,
RFStatsListResponse,
UnknownClientListResponse,
)
from app.services import link_service
router = APIRouter(tags=["links"])
@@ -73,6 +78,38 @@ async def list_site_links(
return await link_service.get_site_links(db=db, tenant_id=tenant_id, site_id=site_id)
@router.get(
"/tenants/{tenant_id}/devices/{device_id}/registrations",
response_model=RegistrationListResponse,
summary="List device wireless registrations",
)
async def list_device_registrations(
tenant_id: uuid.UUID,
device_id: uuid.UUID,
current_user: CurrentUser = Depends(get_current_user),
db: AsyncSession = Depends(get_db),
) -> RegistrationListResponse:
"""Get latest wireless registration data for a device (most recent per MAC)."""
await _check_tenant_access(current_user, tenant_id, db)
return await link_service.get_device_registrations(db=db, tenant_id=tenant_id, device_id=device_id)
@router.get(
"/tenants/{tenant_id}/devices/{device_id}/rf-stats",
response_model=RFStatsListResponse,
summary="List device RF monitor stats",
)
async def list_device_rf_stats(
tenant_id: uuid.UUID,
device_id: uuid.UUID,
current_user: CurrentUser = Depends(get_current_user),
db: AsyncSession = Depends(get_db),
) -> RFStatsListResponse:
"""Get latest RF monitor stats for a device (most recent per interface)."""
await _check_tenant_access(current_user, tenant_id, db)
return await link_service.get_device_rf_stats(db=db, tenant_id=tenant_id, device_id=device_id)
@router.get(
"/tenants/{tenant_id}/devices/{device_id}/unknown-clients",
response_model=UnknownClientListResponse,