feat: add REST API endpoints for events, known objects, and settings
Routes package with CRUD endpoints: event listing/filtering/tagging/dismissal, known object management with thumbnails, settings CRUD, and stats. 64 tests passing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+16
-7
@@ -40,10 +40,15 @@ class KnownObjectResponse(BaseModel):
|
||||
|
||||
|
||||
class TagEventRequest(BaseModel):
|
||||
"""Request model for tagging an event with a known object."""
|
||||
"""Request model for tagging an event with a known object.
|
||||
|
||||
known_object_id: int
|
||||
match_status: str = Field(default="known", pattern="^(known|unknown|ambiguous)$")
|
||||
Either provide known_object_id to link to an existing object,
|
||||
or provide name + type to create a new known object.
|
||||
"""
|
||||
|
||||
known_object_id: Optional[int] = None
|
||||
name: Optional[str] = Field(default=None, min_length=1, max_length=255)
|
||||
type: Optional[str] = Field(default=None, pattern="^(person|vehicle|pet)$")
|
||||
|
||||
|
||||
class EventResponse(BaseModel):
|
||||
@@ -54,8 +59,11 @@ class EventResponse(BaseModel):
|
||||
camera: str
|
||||
label: str
|
||||
score: float
|
||||
has_snapshot: bool = False
|
||||
snapshot_base64: Optional[str] = None
|
||||
match_status: str
|
||||
matched_object_id: Optional[int] = None
|
||||
matched_object_name: Optional[str] = None
|
||||
match_confidence: Optional[float] = None
|
||||
ai_description: Optional[str] = None
|
||||
notified: bool
|
||||
@@ -79,8 +87,9 @@ class SettingsResponse(BaseModel):
|
||||
class StatsResponse(BaseModel):
|
||||
"""Response model for application statistics."""
|
||||
|
||||
events_processed: int
|
||||
mqtt_connected: bool
|
||||
last_event: Optional[str] = None
|
||||
total_events_stored: int = 0
|
||||
total_events: int = 0
|
||||
known_matches: int = 0
|
||||
unknown_events: int = 0
|
||||
unreviewed: int = 0
|
||||
known_objects_count: int = 0
|
||||
events_today: int = 0
|
||||
|
||||
Reference in New Issue
Block a user