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
|
2024-09-03 15:41:37 +02:00
|
|
|
description: str
|
2024-09-15 23:54:47 +02:00
|
|
|
imgUrl: str | None = None
|
2023-11-06 23:15:52 +01:00
|
|
|
status: int = 0
|
2023-11-20 22:40:42 +01:00
|
|
|
latitude: float = 0.0
|
|
|
|
longitude: float = 0.0
|
2023-11-08 22:43:53 +01:00
|
|
|
organizers: list[str] = []
|
2024-10-14 18:03:51 +02:00
|
|
|
tags: 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
|
2024-09-03 15:41:37 +02:00
|
|
|
description: str
|
2024-09-15 23:54:47 +02:00
|
|
|
imgUrl: str | None = None
|
2023-11-06 23:15:52 +01:00
|
|
|
status: int = 0
|
|
|
|
start_date: datetime | None = None
|
2023-11-08 22:43:53 +01:00
|
|
|
end_date: datetime | None = None
|
2024-10-14 18:03:51 +02:00
|
|
|
tags: list[str] = []
|
2023-11-06 23:15:52 +01:00
|
|
|
|
|
|
|
class EventIn(BaseModel):
|
|
|
|
name: str
|
|
|
|
place: str
|
2024-09-03 15:41:37 +02:00
|
|
|
description: str
|
2024-09-15 23:54:47 +02:00
|
|
|
imgUrl: str | None = None
|
2023-11-06 23:15:52 +01:00
|
|
|
status: int = 0
|
2023-11-16 21:40:49 +01:00
|
|
|
organizers: list[str] = []
|
2024-10-14 18:03:51 +02:00
|
|
|
tags: 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-20 22:40:42 +01:00
|
|
|
latitude: float = 0.0
|
|
|
|
longitude: float = 0.0
|
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"
|