27 lines
1.2 KiB
Python
27 lines
1.2 KiB
Python
import uuid
|
|
from pydantic import BaseModel, Field
|
|
|
|
from domains.notifications.models import NotificationType
|
|
|
|
class NotificationBase(BaseModel):
|
|
title: str = Field(..., description='title of the notification')
|
|
description: str | None = Field(None, description='description of the notification')
|
|
type: NotificationType = Field(..., description='type of the notification')
|
|
group_id: uuid.UUID | None = Field(None, description='group id of the notification')
|
|
|
|
class NotificationCreate(NotificationBase):
|
|
receiver_id: uuid.UUID = Field(..., description='receiver id of the notification')
|
|
sender_id: uuid.UUID | None = Field(None, description='sender id of the notification')
|
|
|
|
class NotificationResponse(NotificationBase):
|
|
id: uuid.UUID = Field(..., description='notification id')
|
|
is_accepted: bool | None = Field(..., description='is accepted')
|
|
receiver_id: uuid.UUID = Field(..., description='receiver id of the notification')
|
|
sender_id: uuid.UUID | None = Field(..., description='sender id of the notification')
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
class NotificationAction(BaseModel):
|
|
is_accepted: bool = Field(..., description='is accepted')
|