rez_core 2.2.183 → 2.2.184
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/workflow/controller/comm-template.controller.d.ts +2 -1
- package/dist/module/workflow/controller/comm-template.controller.js +4 -3
- package/dist/module/workflow/controller/comm-template.controller.js.map +1 -1
- package/dist/module/workflow/entity/comm-template.entity.d.ts +1 -0
- package/dist/module/workflow/entity/comm-template.entity.js +4 -0
- package/dist/module/workflow/entity/comm-template.entity.js.map +1 -1
- package/dist/module/workflow/repository/comm-template.repository.d.ts +4 -3
- package/dist/module/workflow/repository/comm-template.repository.js +20 -5
- package/dist/module/workflow/repository/comm-template.repository.js.map +1 -1
- package/dist/module/workflow/service/comm-template.service.d.ts +2 -1
- package/dist/module/workflow/service/comm-template.service.js +3 -2
- package/dist/module/workflow/service/comm-template.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/workflow/controller/comm-template.controller.ts +2 -0
- package/src/module/workflow/entity/comm-template.entity.ts +3 -0
- package/src/module/workflow/repository/comm-template.repository.ts +33 -4
- package/src/module/workflow/service/comm-template.service.ts +7 -1
- package/.vscode/extensions.json +0 -5
package/package.json
CHANGED
|
@@ -21,10 +21,12 @@ export class CommTemplateController {
|
|
|
21
21
|
async getTemplate(
|
|
22
22
|
@Req() req: Request & { user: any },
|
|
23
23
|
@Body('entity_type') entity_type: string,
|
|
24
|
+
@Body('action_id') action_id: number,
|
|
24
25
|
) {
|
|
25
26
|
const loggedInUser = req.user.userData;
|
|
26
27
|
const result = this.commTemplateService.getAllCommTemplate(
|
|
27
28
|
entity_type || '',
|
|
29
|
+
action_id,
|
|
28
30
|
loggedInUser,
|
|
29
31
|
);
|
|
30
32
|
return result;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Injectable, NotFoundException } from '@nestjs/common';
|
|
2
2
|
import { InjectRepository } from '@nestjs/typeorm';
|
|
3
3
|
import { Workflow } from '../entity/workflow.entity';
|
|
4
|
-
import { Repository } from 'typeorm';
|
|
4
|
+
import { DataSource, Repository } from 'typeorm';
|
|
5
5
|
import { CommTemplate } from '../entity/comm-template.entity';
|
|
6
6
|
import { TemplateAttach } from '../entity/template-attach-mapper.entity';
|
|
7
7
|
import { MediaDataService } from 'src/module/meta/service/media-data.service';
|
|
@@ -14,15 +14,44 @@ export class CommTemplateRepository {
|
|
|
14
14
|
@InjectRepository(TemplateAttach)
|
|
15
15
|
private readonly templateAttachEntity: Repository<TemplateAttach>,
|
|
16
16
|
private readonly mediaDataService: MediaDataService,
|
|
17
|
+
private readonly dataSource: DataSource,
|
|
17
18
|
) {}
|
|
18
19
|
|
|
19
|
-
async getAllCommTemplate(
|
|
20
|
+
async getAllCommTemplate(
|
|
21
|
+
entity_type: string,
|
|
22
|
+
action_id: number,
|
|
23
|
+
loggedInUser,
|
|
24
|
+
) {
|
|
20
25
|
const { organization_id } = loggedInUser;
|
|
26
|
+
|
|
27
|
+
const [actionResult] = await this.dataSource.query(
|
|
28
|
+
`SELECT is_template
|
|
29
|
+
FROM cr_wf_action
|
|
30
|
+
WHERE id = ? AND organization_id = ?
|
|
31
|
+
LIMIT 1`,
|
|
32
|
+
[action_id, organization_id],
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
if (!actionResult) {
|
|
36
|
+
throw new Error('Invalid action_id');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const { is_template } = actionResult;
|
|
40
|
+
|
|
41
|
+
await this.dataSource.query(
|
|
42
|
+
`UPDATE cr_wf_comm_template
|
|
43
|
+
SET is_template = ?
|
|
44
|
+
WHERE mapped_entity_type = ?
|
|
45
|
+
AND organization_id = ?`,
|
|
46
|
+
[is_template, entity_type, organization_id],
|
|
47
|
+
);
|
|
48
|
+
|
|
21
49
|
return this.commTemplateRepository.find({
|
|
22
|
-
select: ['name', 'code', 'mode'],
|
|
50
|
+
select: ['name', 'code', 'mode', 'is_template'],
|
|
23
51
|
where: {
|
|
24
52
|
mapped_entity_type: entity_type,
|
|
25
|
-
organization_id
|
|
53
|
+
organization_id,
|
|
54
|
+
is_template,
|
|
26
55
|
},
|
|
27
56
|
});
|
|
28
57
|
}
|
|
@@ -78,10 +78,15 @@ export class CommTemplateService extends EntityServiceImpl {
|
|
|
78
78
|
return getTemplate;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
async getAllCommTemplate(
|
|
81
|
+
async getAllCommTemplate(
|
|
82
|
+
entity_type: string,
|
|
83
|
+
action_id: number,
|
|
84
|
+
loggedInUser,
|
|
85
|
+
) {
|
|
82
86
|
const commTemplateData =
|
|
83
87
|
await this.commTemplateRepository.getAllCommTemplate(
|
|
84
88
|
entity_type,
|
|
89
|
+
action_id,
|
|
85
90
|
loggedInUser,
|
|
86
91
|
);
|
|
87
92
|
|
|
@@ -89,6 +94,7 @@ export class CommTemplateService extends EntityServiceImpl {
|
|
|
89
94
|
value: item.code,
|
|
90
95
|
label: item.name,
|
|
91
96
|
mode: item.mode,
|
|
97
|
+
template: item.is_template,
|
|
92
98
|
}));
|
|
93
99
|
|
|
94
100
|
return response;
|