v1
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
from pydantic import BaseModel, Field
|
||||
from typing import Optional, Dict, Any, List
|
||||
from datetime import datetime
|
||||
import uuid
|
||||
|
||||
|
||||
class EventCreate(BaseModel):
|
||||
event_type: str = Field(..., max_length=64)
|
||||
page: str = Field(..., max_length=255)
|
||||
element: Optional[str] = Field(None, max_length=255)
|
||||
metadata: Optional[Dict[str, Any]] = None
|
||||
session_id: Optional[str] = Field(None, max_length=64)
|
||||
|
||||
|
||||
class EventResponse(BaseModel):
|
||||
id: uuid.UUID
|
||||
event_type: str
|
||||
page: str
|
||||
element: Optional[str]
|
||||
session_id: str
|
||||
ip_partial: Optional[str]
|
||||
browser: Optional[str]
|
||||
os_name: Optional[str]
|
||||
country: Optional[str]
|
||||
city: Optional[str]
|
||||
created_at: datetime
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class DailyStat(BaseModel):
|
||||
date: str
|
||||
count: int
|
||||
|
||||
|
||||
class TopItem(BaseModel):
|
||||
label: str
|
||||
count: int
|
||||
|
||||
|
||||
class AnalyticsSummary(BaseModel):
|
||||
total_events_today: int
|
||||
total_events_yesterday: int
|
||||
page_views_today: int
|
||||
unique_sessions_today: int
|
||||
unique_sessions_total: int
|
||||
total_events_all_time: int
|
||||
events_by_type: List[TopItem]
|
||||
top_pages: List[TopItem]
|
||||
top_elements: List[TopItem]
|
||||
top_journeys: List[TopItem]
|
||||
top_browsers: List[TopItem]
|
||||
top_os: List[TopItem]
|
||||
top_countries: List[TopItem]
|
||||
events_last_7_days: List[DailyStat]
|
||||
recent_events: List[EventResponse]
|
||||
|
||||
|
||||
class BookingActivityStat(BaseModel):
|
||||
date: str
|
||||
booked: int
|
||||
cancellations: int
|
||||
|
||||
|
||||
class BookingForwardLoadStat(BaseModel):
|
||||
date: str
|
||||
total: int
|
||||
am: int
|
||||
pm: int
|
||||
|
||||
|
||||
class BookingCustomerVolume(BaseModel):
|
||||
label: str
|
||||
count: int
|
||||
|
||||
|
||||
class BookingOperationsSummary(BaseModel):
|
||||
active_bookings_total: int
|
||||
forward_load_total: int
|
||||
booked_last_30_days: int
|
||||
cancellations_last_30_days: int
|
||||
high_volume_customer_count: int
|
||||
forward_load_next_14_days: List[BookingForwardLoadStat]
|
||||
activity_last_30_days: List[BookingActivityStat]
|
||||
top_high_volume_customers: List[BookingCustomerVolume]
|
||||
Reference in New Issue
Block a user