40 lines
1.0 KiB
Python
Raw Normal View History

2023-11-06 23:15:52 +01:00
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
2023-11-08 22:43:53 +01:00
organizers: list[str] = []
2023-11-06 23:15:52 +01:00
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
start_date: datetime | None = None
2023-11-08 22:43:53 +01:00
end_date: datetime | None = None
2023-11-06 23:15:52 +01:00
class EventIn(BaseModel):
name: str
place: str
status: int = 0
2023-11-16 21:40:49 +01:00
organizers: list[str] = []
2023-11-06 23:15:52 +01:00
start_date: datetime | None = None
2023-11-08 22:43:53 +01:00
end_date: datetime | None = None
2023-11-06 23:15:52 +01:00
2023-11-08 22:43:53 +01:00
class EventIDS(BaseModel):
ids: list[str]
2023-11-06 23:15:52 +01:00
class EventRepository(AbstractRepository[Event]):
class Meta:
collection_name = "events"