Files
romm/backend/endpoints/responses/play_session.py
nendo 75302ed59a Add play session ingest for game time tracking
Backend API for collecting and querying play sessions, modeled after
the Argosy session data format. Clients submit batches per device,
recording both the session window and screen-on time.
2026-03-22 20:22:55 +09:00

34 lines
700 B
Python

from datetime import datetime
from typing import Literal
from .base import BaseModel
class PlaySessionSchema(BaseModel):
id: int
user_id: int
device_id: str | None
rom_id: int | None
save_slot: str | None
start_time: datetime
end_time: datetime
duration_ms: int
created_at: datetime
updated_at: datetime
class Config:
from_attributes = True
class PlaySessionIngestResult(BaseModel):
index: int
status: Literal["created", "duplicate", "error"]
id: int | None = None
detail: str | None = None
class PlaySessionIngestResponse(BaseModel):
results: list[PlaySessionIngestResult]
created_count: int
skipped_count: int