Files
QuantDinger/backend_api_python/app/utils/notification_display.py
T
Dinger a1a51e9afc v3.0.22
Signed-off-by: Dinger <quantdinger@gmail.com>
2026-05-31 23:39:35 +08:00

15 lines
529 B
Python

"""Structured notification display metadata for in-app (browser) notifications.
The UI renders ``payload.display`` with vue-i18n so stored rows stay locale-neutral.
Legacy rows without ``display`` fall back to stored title/message.
"""
from __future__ import annotations
from typing import Any
def with_display(payload: dict[str, Any] | None, template: str, params: dict[str, Any]) -> dict[str, Any]:
out = dict(payload or {})
out["display"] = {"template": str(template), "params": dict(params or {})}
return out