diff --git a/app/apple_fetch.py b/app/apple_fetch.py index 6b1e89f..f263ff5 100644 --- a/app/apple_fetch.py +++ b/app/apple_fetch.py @@ -36,7 +36,7 @@ def json(self): class AppleLocation(BaseModel): - date_published: int = Field(alias="datePublished") + date_published: int | None = Field(default=None, alias="datePublished") payload: str description: str id: str diff --git a/app/dtos.py b/app/dtos.py index 7df4973..cf17d19 100644 --- a/app/dtos.py +++ b/app/dtos.py @@ -15,7 +15,7 @@ class Report(BaseModel): class EnrichedReport(Report): device_id: str timestamp: int - date_published: int + date_published: int | None = None description: str diff --git a/app/report.py b/app/report.py index 07b39ce..3ec8266 100644 --- a/app/report.py +++ b/app/report.py @@ -76,7 +76,7 @@ def create_reports(locations: list[AppleLocation], devices: list[BeamerDevice]): **report.model_dump(), device_id=device.id, timestamp=timestamp, - date_published=location.date_published, + date_published=location.date_published if location.date_published is not None else timestamp, description=location.description, ) device.report = enriched_report