Skip to main content

Forge Notifications — notifications in-app opt-in : table notifications, API notify/get_notifications/mark_read, SQL visible.

Project description

forge-mvc-notifications

Notifications in-app opt-in pour Forge : créer des notifications destinées aux utilisateurs (élève inscrit, note publiée, devoir à rendre) dans une table notifications, les lire, les marquer comme lues.

Périmètre V1 : notifications in-app (des lignes en base, affichées dans l'IHM). La livraison hors application (email, push) reste à la charge de l'application, par exemple en combinant ce paquet avec forge-mvc-jobs et forge-mvc-mail.

Installation

pip install --pre forge-mvc-notifications

En développement : pip install -e ./packages/forge-mvc-notifications.

Mise en place de la table

forge notifications:init   # copie la migration dans mvc/migrations/
forge migration:apply      # crée la table notifications

Utilisation

from forge_mvc_notifications import notify, get_notifications, unread_count, mark_read

notify("eleve.42", "Votre note est publiée", type="info", data={"cours": "maths"})

print(unread_count("eleve.42"))            # 1
for n in get_notifications("eleve.42", unread_only=True):
    print(n.message, n.created_at)
mark_read(1)

L'API expose notify, get_notifications, unread_count, mark_read, mark_all_read, plus Notification, NotificationError, TABLE_NAME, MAX_LIMIT et CREATE_TABLE_SQL.

Périmètre

  • Stockage in-app uniquement (lignes en base).
  • Hors périmètre : livraison email/push (à combiner avec forge-mvc-jobs + forge-mvc-mail), préférences de notification, temps réel.

Documentation complète : https://forgemvc.com/docs/forge/.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

forge_mvc_notifications-1.0.0rc2.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

forge_mvc_notifications-1.0.0rc2-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file forge_mvc_notifications-1.0.0rc2.tar.gz.

File metadata

File hashes

Hashes for forge_mvc_notifications-1.0.0rc2.tar.gz
Algorithm Hash digest
SHA256 a8f9f31acd16394fafa8b58e522c078957fefe9c6db16b584d1204ec2f7761df
MD5 16de98de4fafe8a50befe15f9f0835f6
BLAKE2b-256 fd0a415ffa7a5a8632c0f22eb176798ecd92f341f1dd68f301a6dfe81722d492

See more details on using hashes here.

File details

Details for the file forge_mvc_notifications-1.0.0rc2-py3-none-any.whl.

File metadata

File hashes

Hashes for forge_mvc_notifications-1.0.0rc2-py3-none-any.whl
Algorithm Hash digest
SHA256 ebac0e2022bd6a40a1db3ad81476f629b16f0cc5542afc89f2f463018735fb4f
MD5 ec7bfef0c3d41c4c882e44f15afa8f41
BLAKE2b-256 89f312d74b09bc38ca19bec4f649549eeab683df015d66ba109a9aca9e2a19fd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page