Skip to content

#feat notification #43#51

Merged
Baptiste-Ferrand merged 7 commits into
developfrom
Feat/notification-#43
Sep 2, 2025
Merged

#feat notification #43#51
Baptiste-Ferrand merged 7 commits into
developfrom
Feat/notification-#43

Conversation

@Baptiste-Ferrand
Copy link
Copy Markdown
Contributor

close #43

@changelog

[Feature] - Notification

Added

  • Daily Notification Feature:
    Implemented a new system to send daily notifications to users. The feature is designed to encourage users to complete their daily checkup and provide feedback to their coach.

  • Scheduled Task:
    Added a background scheduled job (using APScheduler) that runs every day at 00:00 (midnight).
    This task automatically creates a new daily notification for each user profile in the system.
    The scheduler is started as part of the FastAPI app startup event to ensure it runs in the correct event loop.

  • New Notification Endpoints:

    • POST /notifications/create-daily
      Allows an admin to manually trigger the creation of daily notifications for all users.
      Useful for testing or manual re-triggering by administrators.
    • GET /notifications/me
      Retrieves all notifications for the currently authenticated user.
    • POST /notifications/{notification_id}/read
      Marks a specific notification as read by the user.

Changed

  • Refactored the notification service and repository layer to support batch creation of notifications.
  • Improved database session management to ensure safe usage in both request/response cycles and background jobs.

Technical Notes

  • The scheduler uses APScheduler's AsyncIOScheduler and is launched within FastAPI's startup event.
  • When the scheduled job runs, it opens a dedicated async database session and creates notifications for all profiles.
  • The background job and the manual admin endpoint both use the same service logic for consistency.

Example:

  • Every day at 00:00, all users receive a new notification titled "Daily Checkup" prompting them to fill out their daily feedback.
  • Admins can use the new endpoint to manually generate these notifications if needed.

@Baptiste-Ferrand Baptiste-Ferrand merged commit 3071114 into develop Sep 2, 2025
3 checks passed
@github-project-automation github-project-automation Bot moved this from To triage to Done in @Baptiste-Ferrand's BackLogs Sep 2, 2025
@Baptiste-Ferrand Baptiste-Ferrand deleted the Feat/notification-#43 branch September 11, 2025 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

module notification

1 participant