Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Move email sending logic out of job.js #495

Open
stephan271 opened this issue Sep 28, 2021 · 4 comments
Open

Move email sending logic out of job.js #495

stephan271 opened this issue Sep 28, 2021 · 4 comments

Comments

@stephan271
Copy link
Member

Issue Name

EmailLogicExternally

Summary

It may be useful to migrate the email sending logic, currently inside job.js to some site specific code parts.Details to be defined

@stephan271
Copy link
Member Author

For PSI: improve archive email logic to include (a subset) of filenames in the email for archive jobs

@nguyenlinhlinh
Copy link
Contributor

nguyenlinhlinh commented Sep 28, 2021

If you mean the logic for constructing the emails I think we could create email templates using handlebarsjs. We have a project at MAXIV which we need to send emails to user and the code looks much cleaner with help of handlebarsjs.
If you mean something else then you can ignore my comment because this idea only move out the email construction.

@stephan271
Copy link
Member Author

handlebarsjs as a template system could be a useful part of a general solution. In addition we need to find a way to define trigger conditions in a customizable way, such that emails are sent when certain conditions are met (e.g. the status flag in the job model changes from A to B) or something similar. So moving the "business logic" into either some configuration files or site specific js code.

@nguyenlinhlinh
Copy link
Contributor

My knowledge in Loopback is very limited so I can't find any information in documentation that could support my idea. I am thinking of a publisher - subscriber mechanism in loopback (in catamel itself and not to kafka queue or rabbitmq). If there are such similar thing as rxjs in Angular we could emit an event when the job model changes from A to B and the subscriber to would pick up the event and send an email depend on event data.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants