mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-10 15:17:41 +00:00
Add delete user invitation functionality
This commit is contained in:
@ -83,13 +83,12 @@ export class EmailService {
|
||||
);
|
||||
}
|
||||
}
|
||||
async sendEmailWithDisableOrEnableTemplate(
|
||||
async sendEmailWithTemplate(
|
||||
email: string,
|
||||
name: string,
|
||||
isEnable: boolean,
|
||||
isDelete: boolean,
|
||||
): Promise<void> {
|
||||
console.log(isEnable);
|
||||
|
||||
const isProduction = process.env.NODE_ENV === 'production';
|
||||
const API_TOKEN = this.configService.get<string>(
|
||||
'email-config.MAILTRAP_API_TOKEN',
|
||||
@ -97,12 +96,16 @@ export class EmailService {
|
||||
const API_URL = isProduction
|
||||
? SEND_EMAIL_API_URL_PROD
|
||||
: SEND_EMAIL_API_URL_DEV;
|
||||
const TEMPLATE_UUID = isEnable
|
||||
|
||||
// Determine the template UUID based on the arguments
|
||||
const templateUuid = isDelete
|
||||
? this.configService.get<string>(
|
||||
'email-config.MAILTRAP_ENABLE_TEMPLATE_UUID',
|
||||
'email-config.MAILTRAP_DELETE_USER_TEMPLATE_UUID',
|
||||
)
|
||||
: this.configService.get<string>(
|
||||
'email-config.MAILTRAP_DISABLE_TEMPLATE_UUID',
|
||||
isEnable
|
||||
? 'email-config.MAILTRAP_ENABLE_TEMPLATE_UUID'
|
||||
: 'email-config.MAILTRAP_DISABLE_TEMPLATE_UUID',
|
||||
);
|
||||
|
||||
const emailData = {
|
||||
@ -111,12 +114,12 @@ export class EmailService {
|
||||
},
|
||||
to: [
|
||||
{
|
||||
email: email,
|
||||
email,
|
||||
},
|
||||
],
|
||||
template_uuid: TEMPLATE_UUID,
|
||||
template_uuid: templateUuid,
|
||||
template_variables: {
|
||||
name: name,
|
||||
name,
|
||||
},
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user