mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 20:30:33 +00:00
36 lines
844 B
TypeScript
36 lines
844 B
TypeScript
import { Container } from 'typedi';
|
|
import AuthenticationMailMesssages from '@/services/Authentication/AuthenticationMailMessages';
|
|
|
|
export default class ResetPasswordEmailJob {
|
|
/**
|
|
* Constructor method.
|
|
* @param {Agenda} agenda
|
|
*/
|
|
constructor(agenda) {
|
|
agenda.define(
|
|
'reset-password-mail',
|
|
{ priority: 'high' },
|
|
this.handler.bind(this)
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Handle send welcome mail job.
|
|
* @param {Job} job
|
|
* @param {Function} done
|
|
*/
|
|
public async handler(job, done: Function): Promise<void> {
|
|
const { data } = job.attrs;
|
|
const { user, token } = data;
|
|
const authService = Container.get(AuthenticationMailMesssages);
|
|
|
|
try {
|
|
await authService.sendResetPasswordMessage(user, token);
|
|
done();
|
|
} catch (error) {
|
|
console.log(error);
|
|
done(error);
|
|
}
|
|
}
|
|
}
|