diff --git a/src/api/events.py b/src/api/events.py index fac955d..9115c79 100644 --- a/src/api/events.py +++ b/src/api/events.py @@ -50,12 +50,16 @@ class _BaseEventData(BaseModel): class EventData(_BaseEventData): """Data about an event sent to the user.""" + id: PydanticObjectId owner_user_id: PydanticObjectId attendee_ids: list[PydanticObjectId] created_at: datetime @classmethod def from_event(cls, event: Event) -> "EventData": + if event.id is None: + raise MissingIdError(event) + if isinstance(event.user, Link): raise UnfetchedLinkError(event.user) @@ -63,6 +67,7 @@ class EventData(_BaseEventData): raise MissingIdError(event.user) return cls( + id=event.id, owner_user_id=event.user.id, title=event.title, description=event.description,