Port core API routes for sites and devices

This commit is contained in:
2025-10-22 23:43:16 -06:00
parent d0fa6929b2
commit 4bc529aaf4
22 changed files with 2092 additions and 1 deletions

View File

@@ -0,0 +1,43 @@
"""Domain models for operator site management."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Dict, Optional
__all__ = ["SiteSummary", "SiteDeviceMapping"]
@dataclass(frozen=True, slots=True)
class SiteSummary:
"""Representation of a site record including device counts."""
id: int
name: str
description: str
created_at: int
device_count: int
def to_dict(self) -> Dict[str, object]:
return {
"id": self.id,
"name": self.name,
"description": self.description,
"created_at": self.created_at,
"device_count": self.device_count,
}
@dataclass(frozen=True, slots=True)
class SiteDeviceMapping:
"""Mapping entry describing which site a device belongs to."""
hostname: str
site_id: Optional[int]
site_name: str
def to_dict(self) -> Dict[str, object]:
return {
"site_id": self.site_id,
"site_name": self.site_name,
}