mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
23 lines
443 B
TypeScript
23 lines
443 B
TypeScript
import { Container } from 'typedi';
|
|
|
|
export default class SmsNotification {
|
|
constructor(agenda) {
|
|
agenda.define('sms-notification', { priority: 'high' }, this.handler);
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @param {Job}job
|
|
*/
|
|
async handler(job) {
|
|
const { message, to } = job.attrs.data;
|
|
const smsClient = Container.get('SMSClient');
|
|
|
|
try {
|
|
await smsClient.sendMessage(to, message);
|
|
} catch (error) {
|
|
done(e);
|
|
}
|
|
}
|
|
}
|