Include event ids in output
This commit is contained in:
parent
b240612ee2
commit
acd280a243
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue