Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: send notification as email digest implementation #657

Open
wants to merge 10 commits into
base: dev
Choose a base branch
from

Conversation

CFCIfe
Copy link
Contributor

@CFCIfe CFCIfe commented Aug 6, 2024

Add Email Digest Implementation for Notifications

Description

This pull request adds the implementation for sending notifications as email digests. It includes the following changes:

  • Ability to send 2 emails from all user notifications to them by 8 P.M

Changes Made

  • Notification:

    • Extended the notification entity to include created_by field.
  • NotificationsModule:

    • Integrated services and logic to support the generation and sending of email digests.
    • Added schedulers to handle the dispatching of email digests based on user preferences.
  • package.json:

    • Updated dependencies to include any new packages required for email digest functionality (e.g., email sending libraries).

How to Test

  1. Setup:

    • Ensure your environment is configured with the necessary email service credentials.
    • Run npm install to update dependencies.
  2. Testing Email Digest Creation:

    • Create a notification and check if it's correctly marked for inclusion in an email digest.
  3. Testing Email Sending:

    • Ensure the scheduler triggers and sends an email digest at the specified intervals.
    • Verify that the email content includes all the notifications marked for the digest.
  4. Testing User Preferences:

    • Update user notification settings to include preferences for email digests.
    • Check that the system respects these preferences when creating and sending email digests.

Authentication Errors

  • If the user is not authenticated, the system should prevent access to notification creation and retrieval endpoints.
  • Verify that proper error messages are returned for unauthenticated access attempts.

Invalid User ID Errors

  • The system should validate user IDs before creating or sending notifications.
  • Ensure that errors are handled gracefully, and informative messages are provided.

Validation Errors

  • Ensure all notification-related DTOs are validated correctly.
  • Test for missing or incorrect fields and check that appropriate error messages are returned.

Additional Notes

  • This implementation assumes that the email service is configured and operational.
  • Future improvements may include more customizable digest templates as well as plugging the notification system into other services.

Checklist

  • I have performed a self-review of my code.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • New and existing unit tests pass locally with my changes.

@CFCIfe CFCIfe requested review from Homoakin619 and davidolanrewaju and removed request for Homoakin619 August 7, 2024 21:13
CFCIfe added 2 commits August 7, 2024 23:17
chore: Update imports in user.module.ts

fix: Update createUser method in user.service.ts

fix: Update imports in auth.service.ts
Homoakin619
Homoakin619 previously approved these changes Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants