add server to monorepo.

This commit is contained in:
a.bouhuolia
2023-02-03 11:57:50 +02:00
parent 28e309981b
commit 80b97b5fdc
1303 changed files with 137049 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
import { Container } from 'typedi';
import LicenseService from '@/services/Payment/License';
export default class SendLicenseViaPhoneJob {
/**
* Constructor method.
*/
constructor(agenda) {
agenda.define(
'send-license-via-phone',
{ priority: 'high', concurrency: 1, },
this.handler,
);
}
public async handler(job, done: Function): Promise<void> {
const { phoneNumber, licenseCode } = job.attrs.data;
const Logger = Container.get('logger');
const licenseService = Container.get(LicenseService);
Logger.debug(`Send license via phone number - started: ${job.attrs.data}`);
try {
await licenseService.smsMessages.sendLicenseSMSMessage(phoneNumber, licenseCode);
Logger.debug(`Send license via phone number - completed: ${job.attrs.data}`);
done();
} catch(e) {
Logger.error(`Send license via phone number: ${job.attrs.data}, error: ${e}`);
done(e);
}
}
}