]>
Commit | Line | Data |
---|---|---|
94831479 | 1 | import * as Bull from 'bull' |
ecb4e35f C |
2 | import { logger } from '../../../helpers/logger' |
3 | import { Emailer } from '../../emailer' | |
4 | ||
5 | export type EmailPayload = { | |
6 | to: string[] | |
7 | subject: string | |
8 | text: string | |
a4101923 | 9 | from?: string |
ecb4e35f C |
10 | } |
11 | ||
94831479 | 12 | async function processEmail (job: Bull.Job) { |
ecb4e35f C |
13 | const payload = job.data as EmailPayload |
14 | logger.info('Processing email in job %d.', job.id) | |
15 | ||
a4101923 | 16 | return Emailer.Instance.sendMail(payload.to, payload.subject, payload.text, payload.from) |
ecb4e35f C |
17 | } |
18 | ||
19 | // --------------------------------------------------------------------------- | |
20 | ||
21 | export { | |
22 | processEmail | |
23 | } |