DT-1591: Consolidate send mail methods#2911
Open
rushtong wants to merge 7 commits into
Open
Conversation
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR consolidates email persistence into EmailService.sendMessage and introduces an insert-specific mail DTO so the database owns create_date assignment.
Changes:
- Adds
MailMessageInsertfor new email records withoutemailIdorcreateDate. - Updates
MailMessageDAO.insertto populatecreate_datewithNOW(). - Refreshes affected DAO/service tests for the new insert model and date behavior.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/main/java/org/broadinstitute/consent/http/service/EmailService.java |
Inlines send response persistence into sendMessage using MailMessageInsert. |
src/main/java/org/broadinstitute/consent/http/models/mail/MailMessageInsert.java |
Adds insert-only record for persisted email fields. |
src/main/java/org/broadinstitute/consent/http/db/MailMessageDAO.java |
Changes insert binding type and delegates create_date to the database. |
src/test/java/org/broadinstitute/consent/http/service/EmailServiceTest.java |
Updates and expands service tests for SendGrid responses, categories, and persistence. |
src/test/java/org/broadinstitute/consent/http/db/MailMessageDAOTest.java |
Updates DAO tests for MailMessageInsert and database-provided create dates. |
src/test/java/org/broadinstitute/consent/http/db/UserDAOTest.java |
Updates email insert test setup to use MailMessageInsert. |
src/test/java/org/broadinstitute/consent/http/db/ElectionDAOTest.java |
Updates reminder email insert setup to use MailMessageInsert. |
src/test/java/org/broadinstitute/consent/http/db/DataAccessRequestDAOTest.java |
Updates DAR email insert setup to use MailMessageInsert. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Addresses
Partially addresses https://broadworkbench.atlassian.net/browse/DT-1591
Specifically, bullet point 2:
Summary
This PR simplifies
EmailServiceby combining methods. We now delegate the creation date to the database instead of passing it in via application code. Additionally, tests are updated for coverage and comprehensiveness.Have you read CONTRIBUTING.md lately? If not, do that first.