Files
MediaManager/media_manager/notification/schemas.py
Maximilian Dorninger a39e0d204a Ruff enable type annotations rule (#362)
This PR enables the ruff rule for return type annotations (ANN), and
adds the ty package for type checking.
2026-01-06 17:07:19 +01:00

31 lines
831 B
Python

import typing
import uuid
from datetime import datetime
from uuid import UUID
from pydantic import BaseModel, ConfigDict, Field
NotificationId = typing.NewType("NotificationId", UUID)
class Notification(BaseModel):
model_config = ConfigDict(from_attributes=True)
id: NotificationId = Field(
default_factory=lambda: NotificationId(uuid.uuid4()), description="Unique identifier for the notification"
)
read: bool = Field(False, description="Whether the notification has been read")
message: str = Field(description="The content of the notification")
timestamp: datetime = Field(
default_factory=datetime.now, description="The timestamp of the notification"
)
class MessageNotification(BaseModel):
"""
Notification type for messages.
"""
message: str
title: str