feat(backend): platform notifications service with audiences, dedupe, read state and first producers

Platform v2 step 1.11 (APPS_PLATFORM section 10).
- notifications + notification_reads (revision 0010). Text = i18n key notification.<key> + params,
  rendered in the reader's language (en, el added).
- core/notifications.py: notify(key, severity, audience, params, dedupe_key, ttl/expires_at, fold)
  never raises; audience all_managers | perm:<key> | user:<id>; a live duplicate only bumps
  count/last_at (no unread reset, no event). New ones emit WS platform_notification {id} to the
  audience's users (current apps ignore it; phase 2 manager shows it).
- API (core, /api/platform/notifications; /api/notifications is chat's): list with unread count,
  POST /{id}/read, POST /read-all.
- Producers: license.limit_reached (device pairing/reassign/over-limit device, per module/limit/day,
  owners), license.expiring (14/7/3/1 days, from apply_license, owners), support.access_used (each
  use, core.settings.manage), print.failed_final (abandoned retry job, per printer/hour, managers).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-13 11:13:37 +02:00
co-authored by Claude Opus 5.5
parent 94a68b1c06
commit 5a21f67b42
15 changed files with 526 additions and 1 deletions
+12
View File
@@ -68,5 +68,17 @@
"waiter_label": "Σερβιτορος:",
"without": "ΧΩΡΙΣ:"
}
},
"notification": {
"license": {
"limit_reached": "Συμπληρώθηκε το όριο της άδειας: το {module} επιτρέπει {max} {limit}. Αναβαθμίστε την άδεια για περισσότερα.",
"expiring": "Η άδεια λήγει σε {days} ημέρες ({expires_at}). Ανανεώστε την για να κρατήσετε όλες τις λειτουργίες."
},
"support": {
"access_used": "Η υποστήριξη της Xenia συνδέθηκε στο κατάστημα (από {ip})."
},
"print": {
"failed_final": "Ένα δελτίο της παραγγελίας #{order_id} δεν τυπώθηκε ποτέ στον εκτυπωτή {printer} ({attempts} προσπάθειες)."
}
}
}
+12
View File
@@ -68,5 +68,17 @@
"waiter_label": "Waiter:",
"without": "NO:"
}
},
"notification": {
"license": {
"limit_reached": "License limit reached: {module} allows {max} {limit}. Upgrade the license to add more.",
"expiring": "The license expires in {days} days ({expires_at}). Renew it to keep every feature."
},
"support": {
"access_used": "Xenia support logged in to this venue (from {ip})."
},
"print": {
"failed_final": "A ticket for order #{order_id} never printed on {printer} ({attempts} attempts)."
}
}
}