53 lines
1.1 KiB
Python
53 lines
1.1 KiB
Python
from datetime import datetime
|
|
from typing import Any
|
|
|
|
from ninja import Schema
|
|
|
|
|
|
class NotificationSchema(Schema):
|
|
id: str
|
|
type: str
|
|
title: str
|
|
message: str
|
|
level: str
|
|
created_at: datetime | str
|
|
is_seen: bool
|
|
delete_on_seen: bool
|
|
action_url: str | None = None
|
|
entity_type: str | None = None
|
|
entity_id: int | str | None = None
|
|
meta: dict[str, Any] = {}
|
|
|
|
|
|
class NotificationListSchema(Schema):
|
|
count: int
|
|
unread_count: int
|
|
notifications: list[NotificationSchema]
|
|
|
|
|
|
class NotificationSeenIn(Schema):
|
|
id: str
|
|
|
|
|
|
class NotificationSeenResponseSchema(Schema):
|
|
marked_read: bool
|
|
notification_id: str | None = None
|
|
deleted: bool = False
|
|
notification: NotificationSchema | None = None
|
|
unread_count: int | None = None
|
|
|
|
|
|
class NotificationDeleteResponseSchema(Schema):
|
|
deleted: bool
|
|
notification_id: str | None = None
|
|
unread_count: int | None = None
|
|
|
|
|
|
class NotificationMarkAllReadResponseSchema(Schema):
|
|
marked_read: int
|
|
|
|
|
|
class NotificationStreamTokenResponseSchema(Schema):
|
|
token: str
|
|
expires_in: int
|