2024-11-07 17:54:12 +01:00

53 lines
1.3 KiB
Python

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
description: str
imgUrl: str | None = None
status: int = 0
latitude: float = 0.0
longitude: float = 0.0
organizers: list[str] = []
tags: list[str] = []
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
description: str
imgUrl: str | None = None
status: int = 0
start_date: datetime | None = None
end_date: datetime | None = None
tags: list[str] = []
class EventIn(BaseModel):
name: str
place: str
description: str
imgUrl: str | None = None
status: int = 0
organizers: list[str] = []
tags: list[str] = []
start_date: datetime | None = None
end_date: datetime | None = None
latitude: float = 0.0
longitude: float = 0.0
class EventIDS(BaseModel):
ids: list[str]
class EventRepository(AbstractRepository[Event]):
class Meta:
collection_name = "events"