From d87925516a77bd5a37e1e8b34a5064d97e5eff40 Mon Sep 17 00:00:00 2001 From: bonamin Date: Mon, 21 Sep 2026 18:35:20 +0300 Subject: [PATCH] feat(devices): add ResetStatsRequest/ResetStatsResult models MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Missed from the previous Reset Stats commit — these are the request/response schemas for POST /devices/{id}/reset-stats. Co-Authored-By: Claude Sonnet 5 --- backend/devices/models.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/backend/devices/models.py b/backend/devices/models.py index f2a13db..951e874 100644 --- a/backend/devices/models.py +++ b/backend/devices/models.py @@ -226,3 +226,39 @@ class DeviceUserInfo(BaseModel): class DeviceUsersResponse(BaseModel): users: List[DeviceUserInfo] total: int + + +class ResetStatsRequest(BaseModel): + """Which categories of QA/bench test data to clear before shipping a + device to a customer. Each flag is independent — callers check only the + boxes they want. device_stats (Firestore) and current_alerts both default + to False since they need extra care (current_alerts especially — see + ResetStatsResult.current_alerts note).""" + bell_stats: bool = False # Firestore device_stats: totalHammerStrikes, perBellStrikes + playback_stats: bool = False # Firestore device_stats: totalPlaybacks, totalWarningsGiven + device_logs: bool = False # Postgres device_logs + heartbeats: bool = False # Postgres heartbeats + commands: bool = False # Postgres commands + boot_events: bool = False # Postgres device_boot_events (console-side history) + alert_history: bool = False # Postgres device_alert_events + ping_samples: bool = False # Postgres device_ping_samples + diagnostics_reports: bool = False # Postgres device_diagnostics_reports + reports: bool = False # Postgres device_reports (control/reports history, e.g. bell_overload) + current_alerts: bool = False # Postgres device_alerts (LIVE state — opt-in only) + + +class ResetStatsResult(BaseModel): + """Per-category outcome. Postgres/Firestore categories always run + (device connectivity doesn't matter); counts are rows deleted, or null + for categories that weren't requested.""" + bell_stats: Optional[bool] = None + playback_stats: Optional[bool] = None + device_logs: Optional[int] = None + heartbeats: Optional[int] = None + commands: Optional[int] = None + boot_events: Optional[int] = None + alert_history: Optional[int] = None + ping_samples: Optional[int] = None + diagnostics_reports: Optional[int] = None + reports: Optional[int] = None + current_alerts: Optional[int] = None