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

#167891584 Notifications for new travel request(email notification) #46

Merged

Conversation

Pomile
Copy link
Collaborator

@Pomile Pomile commented Sep 5, 2019

What does this PR do?

Have an email notification sent to admin users when new travel request is initiated

Description of Task to be completed?

  • Create Notifications model and migration
  • Create Reads model and migration
  • Create an HTML template for travel request email notification
  • Create a function that finds all admins
  • Build template with data
  • Send email to administrators
  • Add notification data to the database

How should this be manually tested?

Unit test
  1. Clone the project repository
  2. Cd into the project repository
  3. Run git pull
  4. Run git checkout ft-emailNotification-forNewTravelRequest-167891584
  5. Run npm install
  6. Create database database_name
  7. Create .env file
  8. Run npm test
Unit test
  1. Clone the project repository
  2. Cd into the project repository
  3. Run git pull
  4. Run git checkout ft-emailNotification-configOpt-endpoint-167891584
  5. Run npm install
  6. Create database database_name
  7. Create .env file
  8. Run npm test
Development test with Postman
  1. Run npm run devstart
  2. Launch postman
  3. Create a new post request with /api/v1/trips
  4. Add a request body { "type": "oneway", "from": "xxxxxxxxxxxxxxxxx", "departureDate": "2000-09-09", "reason": "Just wanna travel", "destination": { "to": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "accomodation": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx" } }

What are the relevant pivotal tracker stories?

#167891584

Any background context you want to add?

Nil

Screenshots

Nil

@Pomile Pomile added the wip label Sep 5, 2019
@Pomile Pomile force-pushed the ft-emailNotification-forNewTravelRequest-167891584 branch 3 times, most recently from 96c1aa0 to b795db5 Compare September 9, 2019 21:01
@Pomile Pomile requested review from tvpeter, femitj, max-wel and daniellamarr and removed request for tvpeter September 9, 2019 21:12
@Pomile Pomile force-pushed the ft-emailNotification-forNewTravelRequest-167891584 branch 2 times, most recently from dc9635b to 4ff8048 Compare September 11, 2019 20:46
Copy link
Collaborator

@max-wel max-wel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that the Reads table contains read notifications. What if you added a field in the notifications table to handle that instead

module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('Notifications', {
id: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kindly add a field that contains the notification recipient like recipientId

Copy link
Collaborator Author

@Pomile Pomile Sep 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, Maxwell.
Who should be the recipient? I understand that at the present we do not have a department manager. Why do you think need we recipientId in the Notification table? What if I want to send a notification to a group of users?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The user the notification is meant for. I think it's needed so we can fetch all notifications belonging to a particular user

@Pomile Pomile force-pushed the ft-emailNotification-forNewTravelRequest-167891584 branch 11 times, most recently from 049f8f9 to 579dffd Compare September 16, 2019 09:55
…ure for

new travel request

- [x] Create Notifications model and migration
- [x] Create Reads model and migration
- [x] Create an HTML template for travel request email notification
- [x] Create a function that finds all admins
- [x] Build template with data
- [x] Send email message to administrators
- [x] Add notification data to the database

[Finishes #167891584]
@Pomile Pomile force-pushed the ft-emailNotification-forNewTravelRequest-167891584 branch from 579dffd to 362e094 Compare September 16, 2019 10:30
@daniellamarr daniellamarr merged commit 578696d into develop Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants