Include event ids in output

This commit is contained in:
Peter Vacho 2024-12-29 17:32:59 +01:00
parent b240612ee2
commit acd280a243
Signed by: school
GPG key ID: 8CFC3837052871B4

View file

@ -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,