-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add email service #123
Add email service #123
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
78a6476
to
c1c29c2
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## develop #123 +/- ##
==============================================
- Coverage 88.49% 77.43% -11.07%
- Complexity 345 355 +10
==============================================
Files 61 67 +6
Lines 791 935 +144
Branches 65 76 +11
==============================================
+ Hits 700 724 +24
- Misses 57 177 +120
Partials 34 34
☔ View full report in Codecov by Sentry. |
I'm marking as ready for review, but a few things are still missing:
|
Check the documentation preview: https://64148c8507396b40a734ad10--niaefeup-backend-docs.netlify.app |
Check the documentation preview: https://64161557a5113f2455baeb87--niaefeup-backend-docs.netlify.app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What a great PR 🎉 Tremendous job! I left minor/cosmetic suggestions
One thing I don't like is having email
as a top-level package, I think we already have enough of them. What do you think of storing the builders under service/email/
? together with EmailService?
src/main/kotlin/pt/up/fe/ni/website/backend/config/email/EmailConfigProperties.kt
Show resolved
Hide resolved
src/main/kotlin/pt/up/fe/ni/website/backend/email/SimpleEmailBuilder.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/pt/up/fe/ni/website/backend/email/TemplateEmailBuilder.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/pt/up/fe/ni/website/backend/service/EmailService.kt
Outdated
Show resolved
Hide resolved
this.data = data | ||
} | ||
|
||
override fun build(helper: MimeMessageHelper, emailConfigProperties: EmailConfigProperties) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function is a bit verbose, I'd consider splitting it into more methods if possible
Check the documentation preview: https://641c7e9b8ddee704dad18da7--niaefeup-backend-docs.netlify.app |
Have you decided something about the tests? |
744c69c
to
33dc731
Compare
Check the documentation preview: https://649c5a2becd22626c57b25e2--niaefeup-backend-docs.netlify.app |
src/main/kotlin/pt/up/fe/ni/website/backend/email/SimpleEmailBuilder.kt
Outdated
Show resolved
Hide resolved
Check the documentation preview: https://6748a29cc73b7330bd8b3797--niaefeup-backend-docs.netlify.app |
Check the documentation preview: https://6793cddd62e627d5c653cc1b--niaefeup-backend-docs.netlify.app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's looking good so far. Shouldn't we add tests for SimpleEmailBuilder
and TemplateEmailBuilder
too?
src/test/kotlin/pt/up/fe/ni/website/backend/email/BaseEmailBuilderTest.kt
Outdated
Show resolved
Hide resolved
Don't forget to add instructions for testing on the wiki. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the changes from the last time I saw it. Good job with the tests!
One thing that would be great to improve is the size of the PRs. We didn't use to do this in NI but it's much easier to do small and incremental PRs, even if the feature or issue isn't fully closed. This should help make the reviews quicker and avoid having stale CRs for months at a time
PS: you need to fix the lint, it seems
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approve to unblock, but look at the comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job with the tests! There's some simple errors as of now if you could fix that. And don't forget the lint and comments here
src/test/kotlin/pt/up/fe/ni/website/backend/email/SimpleEmailBuilderTest.kt
Show resolved
Hide resolved
src/main/kotlin/pt/up/fe/ni/website/backend/email/ExampleEmailBuilder.kt
Outdated
Show resolved
Hide resolved
c6efe91
to
78fa260
Compare
Check the documentation preview: https://67c0b65a3bf3287b25d1df13--niaefeup-backend-docs.netlify.app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job! A comment for posteriority: If the email tests and application context load fails, delete the website-be-h2-db.mv.db
file in your home folder
Check the documentation preview: https://67cdae385ff4f4a51dcb8f90--niaefeup-backend-docs.netlify.app |
Check the documentation preview: |
Closes #82.
Adds a new
EmailService
with a methodsend
, which receives an instance ofEmailBuilder
.Two builders were implemented:
SimpleEmailBuilder
, which receives all properties directly, andTemplateEmailBuilder
, which generates the subject, content and attachments from the given data using mustache templates.Each different template email should be a subclass of
TemplateEmailBuilder
, here's an example:This sends an email that looks something like this:
Review checklist