quivr/backend/modules/notification/dto/inputs.py
Stan Girard e1ad3dfb2a
feat(notifications): implemented notifications with RLS and realtime (#2525)
This pull request adds the implementation of the notifications feature,
including the ability to create, update, and delete notifications.
2024-05-01 11:11:12 -07:00

27 lines
782 B
Python

from typing import Optional
from uuid import UUID
from modules.notification.entity.notification import NotificationsStatusEnum
from pydantic import BaseModel
class CreateNotification(BaseModel):
"""Properties that can be received on notification creation"""
user_id: UUID
status: NotificationsStatusEnum
title: str
description: Optional[str] = None
def model_dump(self, *args, **kwargs):
notification_dict = super().model_dump(*args, **kwargs)
notification_dict["user_id"] = str(notification_dict["user_id"])
return notification_dict
class NotificationUpdatableProperties(BaseModel):
"""Properties that can be received on notification update"""
status: Optional[NotificationsStatusEnum]
description: Optional[str]