2023-11-28 16:27:39 +03:00
|
|
|
from typing import Optional
|
|
|
|
from uuid import UUID
|
|
|
|
|
|
|
|
from modules.notification.entity.notification import NotificationsStatusEnum
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
|
|
|
2024-05-01 21:11:12 +03:00
|
|
|
class CreateNotification(BaseModel):
|
2023-11-28 16:27:39 +03:00
|
|
|
"""Properties that can be received on notification creation"""
|
|
|
|
|
2024-05-01 21:11:12 +03:00
|
|
|
user_id: UUID
|
|
|
|
status: NotificationsStatusEnum
|
|
|
|
title: str
|
|
|
|
description: Optional[str] = None
|
2023-11-28 16:27:39 +03:00
|
|
|
|
2024-05-01 21:11:12 +03:00
|
|
|
def model_dump(self, *args, **kwargs):
|
|
|
|
notification_dict = super().model_dump(*args, **kwargs)
|
|
|
|
notification_dict["user_id"] = str(notification_dict["user_id"])
|
2023-11-28 16:27:39 +03:00
|
|
|
return notification_dict
|
|
|
|
|
|
|
|
|
|
|
|
class NotificationUpdatableProperties(BaseModel):
|
|
|
|
"""Properties that can be received on notification update"""
|
|
|
|
|
2024-05-01 21:11:12 +03:00
|
|
|
status: Optional[NotificationsStatusEnum]
|
|
|
|
description: Optional[str]
|