rollback models
This commit is contained in:
@@ -31,7 +31,7 @@ class Event(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
class EventOut(BaseModel):
|
class EventOut(BaseModel):
|
||||||
id: str | None = None
|
id: ObjectIdField = None
|
||||||
name: str
|
name: str
|
||||||
place: str
|
place: str
|
||||||
description: str
|
description: str
|
||||||
@@ -43,23 +43,6 @@ 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