From acd280a2439be6b4ef05c47d989b730ece29ee51 Mon Sep 17 00:00:00 2001 From: Peter Vacho Date: Sun, 29 Dec 2024 17:32:59 +0100 Subject: [PATCH] Include event ids in output --- src/api/events.py | 5 +++++ 1 file changed, 5 insertions(+) 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,