rez_core 2.2.100 → 2.2.101
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/extensions.json +5 -0
- package/dist/module/notification/controller/otp.controller.d.ts +6 -2
- package/dist/module/notification/controller/otp.controller.js +1 -1
- package/dist/module/notification/controller/otp.controller.js.map +1 -1
- package/dist/module/notification/service/email.service.d.ts +4 -1
- package/dist/module/notification/service/email.service.js +12 -3
- package/dist/module/notification/service/email.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/notification/controller/otp.controller.ts +3 -1
- package/src/module/notification/service/email.service.ts +12 -3
package/package.json
CHANGED
|
@@ -56,7 +56,8 @@ export class OtpController {
|
|
|
56
56
|
body: {
|
|
57
57
|
to: string;
|
|
58
58
|
subject: string;
|
|
59
|
-
|
|
59
|
+
message: string;
|
|
60
|
+
templateCode: string;
|
|
60
61
|
payload: any;
|
|
61
62
|
},
|
|
62
63
|
) {
|
|
@@ -64,6 +65,7 @@ export class OtpController {
|
|
|
64
65
|
return await this.emailService.sendEmailWithDynamicTemplate(
|
|
65
66
|
body.to,
|
|
66
67
|
body.subject,
|
|
68
|
+
body.message,
|
|
67
69
|
body.templateCode,
|
|
68
70
|
body.payload,
|
|
69
71
|
);
|
|
@@ -35,7 +35,8 @@ export class EmailService {
|
|
|
35
35
|
async sendEmailWithDynamicTemplate(
|
|
36
36
|
email: string,
|
|
37
37
|
subject: string,
|
|
38
|
-
templateCode:
|
|
38
|
+
templateCode: string,
|
|
39
|
+
message?: string,
|
|
39
40
|
context?: any,
|
|
40
41
|
) {
|
|
41
42
|
// retrieve the rich_text from the database table cr_wf_comm_template for the given templateCode
|
|
@@ -45,13 +46,21 @@ export class EmailService {
|
|
|
45
46
|
.findOne({ where: { code: templateCode } });
|
|
46
47
|
|
|
47
48
|
if (!template) {
|
|
48
|
-
|
|
49
|
+
return {
|
|
50
|
+
success: false,
|
|
51
|
+
message: `Template with code ${templateCode} not found`,
|
|
52
|
+
};
|
|
49
53
|
}
|
|
50
54
|
|
|
51
55
|
// Compile the template string with Handlebars
|
|
52
56
|
const templateString = template.rich_text || '';
|
|
53
57
|
|
|
54
|
-
|
|
58
|
+
let compiled;
|
|
59
|
+
if (message) {
|
|
60
|
+
compiled = Handlebars.compile(message);
|
|
61
|
+
} else {
|
|
62
|
+
compiled = Handlebars.compile(templateString);
|
|
63
|
+
}
|
|
55
64
|
const htmlContent = compiled(context);
|
|
56
65
|
|
|
57
66
|
await this.mailerService.sendMail({
|