PeerTube/server/lib/job-queue/handlers/email.ts

23 lines
529 B
TypeScript
Raw Normal View History

2018-07-10 17:02:20 +02:00
import * as Bull from 'bull'
2018-01-30 13:27:07 +01:00
import { logger } from '../../../helpers/logger'
import { Emailer } from '../../emailer'
export type EmailPayload = {
to: string[]
subject: string
text: string
}
2018-07-10 17:02:20 +02:00
async function processEmail (job: Bull.Job) {
2018-01-30 13:27:07 +01:00
const payload = job.data as EmailPayload
logger.info('Processing email in job %d.', job.id)
return Emailer.Instance.sendMail(payload.to, payload.subject, payload.text)
}
// ---------------------------------------------------------------------------
export {
processEmail
}