Compare commits
2 Commits
master
...
d57268f2ce
Author | SHA1 | Date | |
---|---|---|---|
d57268f2ce | |||
028adb6160 |
@@ -31,7 +31,7 @@ class Event(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
class EventOut(BaseModel):
|
class EventOut(BaseModel):
|
||||||
id: ObjectIdField = None
|
id: str | None = None
|
||||||
name: str
|
name: str
|
||||||
place: str
|
place: str
|
||||||
description: str
|
description: str
|
||||||
@@ -43,6 +43,23 @@ class EventOut(BaseModel):
|
|||||||
end_date: datetime | None = None
|
end_date: datetime | None = None
|
||||||
tags: list[str] = []
|
tags: list[str] = []
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_mongo(cls, event: Event) -> "EventOut":
|
||||||
|
return cls(
|
||||||
|
id=str(event.id) if event.id else None,
|
||||||
|
name=event.name,
|
||||||
|
place=event.place,
|
||||||
|
description=event.description,
|
||||||
|
imgUrl=event.imgUrl,
|
||||||
|
link=event.link,
|
||||||
|
ticket=event.ticket,
|
||||||
|
status=event.status,
|
||||||
|
start_date=event.start_date,
|
||||||
|
end_date=event.end_date,
|
||||||
|
tags=event.tags,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class EventOutWithInterested(EventOut):
|
class EventOutWithInterested(EventOut):
|
||||||
interested: bool = False
|
interested: bool = False
|
||||||
interested_count: int = 0
|
interested_count: int = 0
|
||||||
|
Reference in New Issue
Block a user