Include event ids in output
This commit is contained in:
parent
b240612ee2
commit
acd280a243
|
@ -50,12 +50,16 @@ class _BaseEventData(BaseModel):
|
||||||
class EventData(_BaseEventData):
|
class EventData(_BaseEventData):
|
||||||
"""Data about an event sent to the user."""
|
"""Data about an event sent to the user."""
|
||||||
|
|
||||||
|
id: PydanticObjectId
|
||||||
owner_user_id: PydanticObjectId
|
owner_user_id: PydanticObjectId
|
||||||
attendee_ids: list[PydanticObjectId]
|
attendee_ids: list[PydanticObjectId]
|
||||||
created_at: datetime
|
created_at: datetime
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_event(cls, event: Event) -> "EventData":
|
def from_event(cls, event: Event) -> "EventData":
|
||||||
|
if event.id is None:
|
||||||
|
raise MissingIdError(event)
|
||||||
|
|
||||||
if isinstance(event.user, Link):
|
if isinstance(event.user, Link):
|
||||||
raise UnfetchedLinkError(event.user)
|
raise UnfetchedLinkError(event.user)
|
||||||
|
|
||||||
|
@ -63,6 +67,7 @@ class EventData(_BaseEventData):
|
||||||
raise MissingIdError(event.user)
|
raise MissingIdError(event.user)
|
||||||
|
|
||||||
return cls(
|
return cls(
|
||||||
|
id=event.id,
|
||||||
owner_user_id=event.user.id,
|
owner_user_id=event.user.id,
|
||||||
title=event.title,
|
title=event.title,
|
||||||
description=event.description,
|
description=event.description,
|
||||||
|
|
Loading…
Reference in a new issue