mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-14 17:03:29 +03:00
575d9886c5
* feat: add notifications table * feat: add Notification model * feat: add notification repositories * feat: add upload and crawl notifications * feat: update notification message
26 lines
616 B
Python
26 lines
616 B
Python
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
|
|
chat_id: Optional[UUID]
|
|
message: Optional[str]
|
|
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
|