File size: 736 Bytes
c6abe34 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | from uuid import UUID
from datetime import datetime
from typing import Optional, List
from pydantic import BaseModel
class NotificationBase(BaseModel):
recipient_id: UUID
title: str
message: str
type: str = "info" # info, warning, success, error
read: bool = False
action_link: Optional[str] = None
class NotificationCreate(NotificationBase):
pass
class NotificationUpdate(BaseModel):
read: Optional[bool] = None
class Notification(NotificationBase):
id: UUID
created_at: datetime
updated_at: Optional[datetime] = None
class Config:
from_attributes = True
class NotificationListResponse(BaseModel):
notifications: List[Notification]
total: int
unread_count: int
|