File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed
backend/app/schemas_pydantic Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change 44from pydantic import BaseModel , ConfigDict , Field
55
66from app .domain .enums .events import EventType
7+ from app .schemas_pydantic .events import HourlyEventCountSchema
78
89
910class EventFilter (BaseModel ):
@@ -97,14 +98,23 @@ class EventDeleteResponse(BaseModel):
9798 event_id : str
9899
99100
101+ class UserEventCountSchema (BaseModel ):
102+ """User event count schema"""
103+
104+ model_config = ConfigDict (from_attributes = True )
105+
106+ user_id : str
107+ event_count : int
108+
109+
100110class EventStatsResponse (BaseModel ):
101111 """Response model for event statistics"""
102112
103113 model_config = ConfigDict (from_attributes = True )
104114
105115 total_events : int
106116 events_by_type : Dict [str , int ]
107- events_by_hour : List [Dict [ str , Any ] ]
108- top_users : List [Dict [ str , Any ] ]
117+ events_by_hour : List [HourlyEventCountSchema ]
118+ top_users : List [UserEventCountSchema ]
109119 error_rate : float
110120 avg_processing_time : float
Original file line number Diff line number Diff line change 1414from app .domain .enums .events import EventType
1515
1616
17+ class HourlyEventCountSchema (BaseModel ):
18+ """Hourly event count for statistics."""
19+
20+ model_config = ConfigDict (from_attributes = True )
21+
22+ hour : str
23+ count : int
24+
25+
1726class EventMetadataResponse (BaseModel ):
1827 """Pydantic schema for event metadata in API responses."""
1928
@@ -205,7 +214,7 @@ class EventStatistics(BaseModel):
205214 total_events : int
206215 events_by_type : Dict [str , int ]
207216 events_by_service : Dict [str , int ]
208- events_by_hour : List [Dict [ str , Any ] ]
217+ events_by_hour : List [HourlyEventCountSchema ]
209218 start_time : datetime | None = None
210219 end_time : datetime | None = None
211220
You can’t perform that action at this time.
0 commit comments