Files
2026-02-27 23:33:56 +03:00

54 lines
1.2 KiB
Python

from __future__ import annotations
from datetime import datetime
from typing import Literal
from uuid import UUID
from cpv3.common.schemas import Schema
NotificationTypeEnum = Literal["task_progress", "task_complete", "task_failed"]
class NotificationCreate(Schema):
user_id: UUID
job_id: UUID | None = None
project_id: UUID | None = None
notification_type: NotificationTypeEnum
title: str
message: str | None = None
payload: dict | None = None
class NotificationRead(Schema):
id: UUID
user_id: UUID
job_id: UUID | None
project_id: UUID | None
notification_type: NotificationTypeEnum
title: str
message: str | None
payload: dict | None
is_read: bool
created_at: datetime
updated_at: datetime
class NotificationUpdate(Schema):
is_read: bool | None = None
class WebSocketMessage(Schema):
"""JSON shape pushed over WebSocket."""
event: str
notification_id: UUID | None = None
job_id: UUID | None = None
project_id: UUID | None = None
job_type: str | None = None
status: str | None = None
progress_pct: float | None = None
message: str | None = None
title: str | None = None
created_at: datetime | None = None