From 75a6802c155bf567fbd8b9fca812fae39138d383 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Mon, 6 Nov 2023 23:15:52 +0100 Subject: [PATCH] add event --- app/models/events.py | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 app/models/events.py diff --git a/app/models/events.py b/app/models/events.py new file mode 100644 index 0000000..c6fef02 --- /dev/null +++ b/app/models/events.py @@ -0,0 +1,43 @@ +from pydantic import BaseModel, EmailStr +from pydantic_mongo import AbstractRepository, ObjectIdField +from datetime import datetime, date + +class Event(BaseModel): + id: ObjectIdField = None + name: str + place: str + status: int = 0 + participants: list[str] | None = None + organizers: list[str] | None = None + interested: list[str] | None = None + start_date: datetime | None = None + end_date: datetime | None = None + created_at: datetime = datetime.today() + updated_at: datetime | None = None + deleted_at: datetime | None = None + disabled_at: datetime | None = None + +class EventOut(BaseModel): + id: ObjectIdField = None + name: str + place: str + status: int = 0 + participants: list[str] | None = None + organizers: list[str] | None = None + interested: list[str] | None = None + start_date: datetime | None = None + +class EventIn(BaseModel): + name: str + place: str + status: int = 0 + participants: list[str] | None = None + organizers: list[str] | None = None + interested: list[str] | None = None + start_date: datetime | None = None + + + +class EventRepository(AbstractRepository[Event]): + class Meta: + collection_name = "events" \ No newline at end of file