rez_core 2.2.91 → 2.2.93
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/dist/module/listmaster/controller/list-master.controller.d.ts +3 -0
- package/dist/module/listmaster/controller/list-master.controller.js +14 -0
- package/dist/module/listmaster/controller/list-master.controller.js.map +1 -1
- package/dist/module/listmaster/service/list-master-item.service.d.ts +4 -1
- package/dist/module/listmaster/service/list-master-item.service.js +11 -2
- package/dist/module/listmaster/service/list-master-item.service.js.map +1 -1
- package/dist/module/notification/service/email.service.d.ts +1 -1
- package/dist/module/notification/service/email.service.js +11 -7
- 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/listmaster/controller/list-master.controller.ts +15 -0
- package/src/module/listmaster/service/list-master-item.service.ts +15 -0
- package/src/module/notification/service/email.service.ts +14 -7
package/package.json
CHANGED
|
@@ -50,6 +50,21 @@ export class ListMasterController {
|
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
@Get('/getDataSourceList/:source')
|
|
54
|
+
@UseGuards(JwtAuthGuard)
|
|
55
|
+
@HttpCode(HttpStatus.OK)
|
|
56
|
+
async getListSourceType(
|
|
57
|
+
@Req() req: Request & { user: any },
|
|
58
|
+
@Param('source') source: string,
|
|
59
|
+
) {
|
|
60
|
+
const loggedInUser = req.user.userData;
|
|
61
|
+
|
|
62
|
+
return await this.listMasterItemService.getListSourceType(
|
|
63
|
+
loggedInUser,
|
|
64
|
+
source,
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
53
68
|
// @Post('/getResolvedListMasterItems/:type')
|
|
54
69
|
// @UseGuards(JwtAuthGuard)
|
|
55
70
|
// @HttpCode(HttpStatus.OK)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DataSource } from 'typeorm';
|
|
1
2
|
import {
|
|
2
3
|
BadRequestException,
|
|
3
4
|
forwardRef,
|
|
@@ -19,6 +20,7 @@ export class ListMasterItemService extends EntityServiceImpl {
|
|
|
19
20
|
@Inject(forwardRef(() => EntityServiceImpl))
|
|
20
21
|
private readonly entityServiceImpl: EntityServiceImpl,
|
|
21
22
|
protected readonly attributeMasterService: AttributeMasterService,
|
|
23
|
+
private readonly dataSource: DataSource,
|
|
22
24
|
) {
|
|
23
25
|
super();
|
|
24
26
|
}
|
|
@@ -183,6 +185,19 @@ export class ListMasterItemService extends EntityServiceImpl {
|
|
|
183
185
|
return `Item with name ${code} deleted successfully from type ${listType}`;
|
|
184
186
|
}
|
|
185
187
|
|
|
188
|
+
async getListSourceType(
|
|
189
|
+
loggedInUser: UserData,
|
|
190
|
+
source: string,
|
|
191
|
+
): Promise<any> {
|
|
192
|
+
const data = await this.dataSource.query(
|
|
193
|
+
`SELECT name AS label, type AS value
|
|
194
|
+
FROM cr_list_master
|
|
195
|
+
WHERE organization_id = ? AND source = ?`,
|
|
196
|
+
[loggedInUser.organization_id, source],
|
|
197
|
+
);
|
|
198
|
+
return data;
|
|
199
|
+
}
|
|
200
|
+
|
|
186
201
|
// async getResolvedListMasterItems(
|
|
187
202
|
// loggedInUser: UserData,
|
|
188
203
|
// entityData: any,
|
|
@@ -10,16 +10,23 @@ export class EmailService {
|
|
|
10
10
|
private readonly datasource: DataSource,
|
|
11
11
|
) {}
|
|
12
12
|
|
|
13
|
-
async sendEmail(email,
|
|
13
|
+
async sendEmail(email: string, subject: string, context?: any) {
|
|
14
|
+
const template = await this.datasource
|
|
15
|
+
.getRepository('cr_wf_comm_template')
|
|
16
|
+
.findOne({ where: { code: 'OTP_TEMPLATE' } });
|
|
17
|
+
|
|
18
|
+
if (!template) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const compiled = Handlebars.compile(template.rich_text || '');
|
|
23
|
+
const htmlContent = compiled(context);
|
|
24
|
+
|
|
14
25
|
this.mailerService
|
|
15
26
|
.sendMail({
|
|
16
27
|
to: email,
|
|
17
|
-
subject:
|
|
18
|
-
|
|
19
|
-
context: {
|
|
20
|
-
name,
|
|
21
|
-
otp,
|
|
22
|
-
},
|
|
28
|
+
subject: subject,
|
|
29
|
+
html: htmlContent,
|
|
23
30
|
})
|
|
24
31
|
.then(() => {})
|
|
25
32
|
.catch(() => {});
|