Her 54 notify users of booking status #60
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue HER-54: Notify Users of Booking Status
https://raquelanaroman.atlassian.net/browse/HER-54
Description
As a teacher user, I want to be notified by email when a booking has been successfully submitted so that I have a record of my booking.
As a speaker user, I want to be notified by email when a booking has been created so that I can review the details and confirm or decline the booking.
Acceptance Criteria
Mailer Setup:
A mailer named BookingMailer should be generated.
The BookingMailer should have two methods:
booking_confirmation(user, booking): Sends a confirmation email to the user (teacher) with the subject "Booking Request Confirmation".
new_booking_notification(speaker, booking): Sends a notification email to the speaker with the subject "New Booking Request".
Controller Logic:
The BookingsController should be updated to send emails when a booking is created.
When a booking is successfully created, the following emails should be sent:
A confirmation email to the user (teacher) using BookingMailer.booking_confirmation.
A notification email to the speaker using BookingMailer.new_booking_notification.
Booking Creation:
The create action in the BookingsController should permit the following parameters: :event_id, :start_time, :end_time, :location.
Upon successful creation of a booking, the mailers should be triggered to send the appropriate emails.
Testing:
Tests should be written to ensure that the mailers are correctly triggered and that the emails contain the expected content.
Tests should verify that the Booking model relationships are correctly set up and that the BookingsController handles booking creation and email sending as expected.
Implementation
Generate a Mailer:
rails generate mailer BookingMailer
Define the Mailer:
Call the Mailer in the Controller: Update the controller to send the emails when a booking is created.
Changes
Review Checklist