mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 23:30:32 +00:00
31 lines
713 B
TypeScript
31 lines
713 B
TypeScript
import { IAuthSignedUpEventPayload } from '@/interfaces';
|
|
import events from '@/subscribers/events';
|
|
import { Inject } from 'typedi';
|
|
|
|
export class SendVerfiyMailOnSignUp {
|
|
@Inject('agenda')
|
|
private agenda: any;
|
|
|
|
/**
|
|
* Attaches events with handles.
|
|
*/
|
|
public attach(bus) {
|
|
bus.subscribe(events.auth.signUp, this.handleSendVerifyMailOnSignup);
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @param {ITaxRateEditedPayload} payload -
|
|
*/
|
|
private handleSendVerifyMailOnSignup = async ({
|
|
user,
|
|
}: IAuthSignedUpEventPayload) => {
|
|
const payload = {
|
|
email: user.email,
|
|
token: user.verifyToken,
|
|
fullName: user.firstName,
|
|
};
|
|
await this.agenda.now('send-signup-verify-mail', payload);
|
|
};
|
|
}
|