2023-09-07 14:22:06 +03:00
|
|
|
from enum import Enum
|
|
|
|
from typing import Optional
|
|
|
|
from uuid import UUID
|
|
|
|
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
|
|
|
|
|
|
class NotificationsStatusEnum(str, Enum):
|
|
|
|
Pending = "Pending"
|
|
|
|
Done = "Done"
|
|
|
|
|
|
|
|
|
|
|
|
class Notification(BaseModel):
|
|
|
|
id: UUID
|
|
|
|
datetime: str
|
2024-02-15 01:01:35 +03:00
|
|
|
chat_id: Optional[UUID] = None
|
|
|
|
message: Optional[str] = None
|
2023-09-07 14:22:06 +03:00
|
|
|
action: str
|
|
|
|
status: NotificationsStatusEnum
|
|
|
|
|
|
|
|
def dict(self, *args, **kwargs):
|
|
|
|
notification_dict = super().dict(*args, **kwargs)
|
|
|
|
if notification_dict.get("chat_id"):
|
|
|
|
notification_dict["chat_id"] = str(notification_dict.get("chat_id"))
|
|
|
|
return notification_dict
|