Files
romm/backend/handler/database/__init__.py
zurdi ff6b160117 feat: persistent notifications
Toasts disappear after a few seconds, and nothing reaches a user who has no
tab open. Notifications are now stored per user and kept until dismissed, so
what a background job or another user did is waiting the next time RomM is
opened.

Backend:
- `notifications` table (0130) with kind, level, data, actor and read_at, capped
  at the newest 200 per user.
- /api/notifications: list, mark read, dismiss one, dismiss all.
- notify()/notify_admins() store the row and push `notifications:new` to the
  user's socket room; read/dismiss push to the user's other tabs.
- Producers: a scan's end (to whoever started it; an unattended scan tells
  the admins when it failed or found new games), a manual task's end (to who
  ran it; a scheduled task's failure to the admins), an admin ending someone's
  stream, and an admin changing someone's role.

Frontend (v2):
- Unread count badge on the navbar avatar, and a Notifications entry in the
  user menu and settings sidebar.
- Notifications view: marks what it shows read, links each row to what it is
  about, dismiss one or all.
- Live toast for a new notification, except scans, which already toast.
- The text is rendered from the kind in the reader's language (18 locales).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 10:35:33 +02:00

42 lines
1.9 KiB
Python

from .client_tokens_handler import DBClientTokensHandler
from .collections_handler import DBCollectionsHandler
from .container_adoptions_handler import DBContainerAdoptionsHandler
from .device_save_sync_handler import DBDeviceSaveSyncHandler
from .devices_handler import DBDevicesHandler
from .firmware_handler import DBFirmwareHandler
from .memory_cards_handler import DBMemoryCardsHandler
from .music_playlists_handler import DBMusicPlaylistsHandler
from .notifications_handler import DBNotificationsHandler
from .permissions_handler import DBPermissionsHandler
from .platforms_handler import DBPlatformsHandler
from .play_sessions_handler import DBPlaySessionsHandler
from .recommendations_handler import DBRecommendationsHandler
from .roms_handler import DBRomsHandler
from .saves_handler import DBSavesHandler
from .screenshots_handler import DBScreenshotsHandler
from .states_handler import DBStatesHandler
from .stats_handler import DBStatsHandler
from .sync_sessions_handler import DBSyncSessionsHandler
from .users_handler import DBUsersHandler
db_client_token_handler = DBClientTokensHandler()
db_collection_handler = DBCollectionsHandler()
db_container_adoption_handler = DBContainerAdoptionsHandler()
db_device_handler = DBDevicesHandler()
db_device_save_sync_handler = DBDeviceSaveSyncHandler()
db_firmware_handler = DBFirmwareHandler()
db_memory_card_handler = DBMemoryCardsHandler()
db_music_playlist_handler = DBMusicPlaylistsHandler()
db_notification_handler = DBNotificationsHandler()
db_permission_handler = DBPermissionsHandler()
db_platform_handler = DBPlatformsHandler()
db_play_session_handler = DBPlaySessionsHandler()
db_recommendation_handler = DBRecommendationsHandler()
db_rom_handler = DBRomsHandler()
db_save_handler = DBSavesHandler()
db_screenshot_handler = DBScreenshotsHandler()
db_state_handler = DBStatesHandler()
db_stats_handler = DBStatsHandler()
db_sync_session_handler = DBSyncSessionsHandler()
db_user_handler = DBUsersHandler()