pJeyakumar / noticed_upgrade_project

2 stars 0 forks source link

Update Seed File to Generate Notification Data and Implement Email Skipping #26

Closed hvillero closed 5 months ago

hvillero commented 5 months ago

Description

This PR updates the seed file to create a substantial amount of notification data for testing and development purposes. Additionally, it implements a mechanism to skip sending email notifications during the seeding process. This is achieved by using a global configuration controlled by an environment variable.

Key Changes

  1. Seed File Updates:

    • The db/seeds.rb file has been modified to create 1000 notifications for each type (NewAircraftCreatedNotification, LogbookEntryUpdatedNotification, NewLogbookEntryCreatedNotification, UserSignUpNotification, and UserUpdateNotification).
  2. Skip Email Notifications:

    • Introduced a global configuration in config/application.rb to control email notifications using the SEND_EMAIL_NOTIFICATIONS environment variable.
    • Updated notification classes to check the global configuration before sending email notifications.

Files Changed

Instructions

Set Environment Variable

For development and test environments, set the environment variable to false to skip email notifications:

export SEND_EMAIL_NOTIFICATIONS=false

How to Test

Development Environment:

hvillero commented 5 months ago

@jonathanloos, @srb-, @pJeyakumar, all the suggestions have been addressed; thx for the review.