chore: Refactoring event processors and service architecture (#2495)
This commit is contained in:
14
server/queues/processors/emails.js
Normal file
14
server/queues/processors/emails.js
Normal file
@ -0,0 +1,14 @@
|
||||
// @flow
|
||||
import mailer, { type EmailSendOptions, type EmailTypes } from "../../mailer";
|
||||
|
||||
type EmailEvent = {
|
||||
type: EmailTypes,
|
||||
opts: EmailSendOptions,
|
||||
};
|
||||
|
||||
export default class EmailsProcessor {
|
||||
async on(event: EmailEvent) {
|
||||
// $FlowIssue flow rightly doesn't like dynaic values
|
||||
await mailer[event.type](event.opts);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user