rez_core 2.1.145 → 2.1.148
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/layout_preference/controller/layout_preference.controller.js +2 -2
- package/dist/module/layout_preference/controller/layout_preference.controller.js.map +1 -1
- package/dist/module/layout_preference/entity/layout_preference.entity.d.ts +2 -0
- package/dist/module/layout_preference/entity/layout_preference.entity.js +13 -0
- package/dist/module/layout_preference/entity/layout_preference.entity.js.map +1 -1
- package/dist/module/layout_preference/repository/layout_preference.repository.d.ts +1 -1
- package/dist/module/layout_preference/repository/layout_preference.repository.js +4 -2
- package/dist/module/layout_preference/repository/layout_preference.repository.js.map +1 -1
- package/dist/module/layout_preference/service/layout_preference.service.d.ts +1 -1
- package/dist/module/layout_preference/service/layout_preference.service.js +10 -4
- package/dist/module/layout_preference/service/layout_preference.service.js.map +1 -1
- package/dist/module/meta/controller/media.controller.d.ts +1 -1
- package/dist/module/meta/controller/media.controller.js +1 -1
- package/dist/module/meta/controller/media.controller.js.map +1 -1
- package/dist/module/workflow/controller/action-category.controller.d.ts +8 -0
- package/dist/module/workflow/controller/action-category.controller.js +45 -0
- package/dist/module/workflow/controller/action-category.controller.js.map +1 -0
- package/dist/module/workflow/controller/action.controller.d.ts +1 -1
- package/dist/module/workflow/controller/action.controller.js +3 -3
- package/dist/module/workflow/controller/action.controller.js.map +1 -1
- package/dist/module/workflow/controller/comm-template.controller.d.ts +2 -2
- package/dist/module/workflow/controller/comm-template.controller.js +4 -4
- package/dist/module/workflow/controller/comm-template.controller.js.map +1 -1
- package/dist/module/workflow/controller/workflow-meta.controller.d.ts +9 -0
- package/dist/module/workflow/controller/workflow-meta.controller.js +63 -0
- package/dist/module/workflow/controller/workflow-meta.controller.js.map +1 -0
- package/dist/module/workflow/controller/workflow.controller.d.ts +9 -1
- package/dist/module/workflow/controller/workflow.controller.js +17 -2
- package/dist/module/workflow/controller/workflow.controller.js.map +1 -1
- package/dist/module/workflow/entity/action-category.entity.d.ts +1 -0
- package/dist/module/workflow/entity/action-category.entity.js +4 -0
- package/dist/module/workflow/entity/action-category.entity.js.map +1 -1
- package/dist/module/workflow/entity/action.entity.d.ts +2 -2
- package/dist/module/workflow/entity/action.entity.js +3 -3
- package/dist/module/workflow/entity/action.entity.js.map +1 -1
- package/dist/module/workflow/entity/comm-template.entity.d.ts +5 -0
- package/dist/module/workflow/entity/comm-template.entity.js +21 -1
- package/dist/module/workflow/entity/comm-template.entity.js.map +1 -1
- package/dist/module/workflow/entity/stage-movement-data.entity.d.ts +2 -0
- package/dist/module/workflow/entity/stage-movement-data.entity.js +8 -0
- package/dist/module/workflow/entity/stage-movement-data.entity.js.map +1 -1
- package/dist/module/workflow/entity/template-attach-mapper.entity.d.ts +11 -0
- package/dist/module/workflow/entity/template-attach-mapper.entity.js +54 -0
- package/dist/module/workflow/entity/template-attach-mapper.entity.js.map +1 -0
- package/dist/module/workflow/repository/comm-template.repository.d.ts +8 -2
- package/dist/module/workflow/repository/comm-template.repository.js +37 -6
- package/dist/module/workflow/repository/comm-template.repository.js.map +1 -1
- package/dist/module/workflow/service/action-category.service.d.ts +5 -0
- package/dist/module/workflow/service/action-category.service.js +23 -1
- package/dist/module/workflow/service/action-category.service.js.map +1 -1
- package/dist/module/workflow/service/action.service.d.ts +1 -1
- package/dist/module/workflow/service/action.service.js +78 -26
- package/dist/module/workflow/service/action.service.js.map +1 -1
- package/dist/module/workflow/service/comm-template.service.d.ts +4 -1
- package/dist/module/workflow/service/comm-template.service.js +38 -1
- package/dist/module/workflow/service/comm-template.service.js.map +1 -1
- package/dist/module/workflow/service/populate-workflow.service.d.ts +21 -0
- package/dist/module/workflow/service/populate-workflow.service.js +124 -0
- package/dist/module/workflow/service/populate-workflow.service.js.map +1 -0
- package/dist/module/workflow/service/workflow-list-master.service.js +3 -3
- package/dist/module/workflow/service/workflow-meta.service.d.ts +9 -0
- package/dist/module/workflow/service/workflow-meta.service.js +81 -0
- package/dist/module/workflow/service/workflow-meta.service.js.map +1 -0
- package/dist/module/workflow/workflow.module.js +41 -26
- package/dist/module/workflow/workflow.module.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/layout_preference/controller/layout_preference.controller.ts +4 -2
- package/src/module/layout_preference/entity/layout_preference.entity.ts +11 -0
- package/src/module/layout_preference/repository/layout_preference.repository.ts +6 -2
- package/src/module/layout_preference/service/layout_preference.service.ts +24 -6
- package/src/module/meta/controller/media.controller.ts +5 -7
- package/src/module/workflow/controller/action-category.controller.ts +35 -0
- package/src/module/workflow/controller/action.controller.ts +2 -2
- package/src/module/workflow/controller/comm-template.controller.ts +5 -4
- package/src/module/workflow/controller/workflow-meta.controller.ts +52 -0
- package/src/module/workflow/controller/workflow.controller.ts +14 -0
- package/src/module/workflow/entity/action-category.entity.ts +3 -0
- package/src/module/workflow/entity/action.entity.ts +3 -3
- package/src/module/workflow/entity/comm-template.entity.ts +18 -1
- package/src/module/workflow/entity/stage-movement-data.entity.ts +6 -0
- package/src/module/workflow/entity/template-attach-mapper.entity.ts +30 -0
- package/src/module/workflow/repository/comm-template.repository.ts +58 -5
- package/src/module/workflow/service/action-category.service.ts +26 -1
- package/src/module/workflow/service/action-template-mapping.service.ts +1 -1
- package/src/module/workflow/service/action.service.ts +103 -24
- package/src/module/workflow/service/comm-template.service.ts +54 -1
- package/src/module/workflow/service/populate-workflow.service.ts +189 -0
- package/src/module/workflow/service/workflow-list-master.service.ts +3 -3
- package/src/module/workflow/service/workflow-meta.service.ts +98 -0
- package/src/module/workflow/workflow.module.ts +41 -27
package/package.json
CHANGED
|
@@ -15,11 +15,13 @@ export class LayoutPreferenceController {
|
|
|
15
15
|
@Query('entity_type') entity_type: string,
|
|
16
16
|
@Req() req: Request & { user: any },
|
|
17
17
|
) {
|
|
18
|
-
const
|
|
18
|
+
const userDat = req.user.userData;
|
|
19
19
|
|
|
20
20
|
return this.layoutPreferenceService.getLayoutPreferenceByUserID(
|
|
21
|
-
|
|
21
|
+
userDat.id,
|
|
22
22
|
entity_type,
|
|
23
|
+
userDat.level_id,
|
|
24
|
+
userDat.level_type,
|
|
23
25
|
);
|
|
24
26
|
}
|
|
25
27
|
|
|
@@ -14,4 +14,15 @@ export class LayoutPreference extends BaseEntity {
|
|
|
14
14
|
|
|
15
15
|
@Column({ nullable: true, type: 'json' })
|
|
16
16
|
navigation_tabs_json: any;
|
|
17
|
+
|
|
18
|
+
@Column({
|
|
19
|
+
name: 'mapped_level_id',
|
|
20
|
+
type: 'varchar',
|
|
21
|
+
length: 100,
|
|
22
|
+
nullable: true,
|
|
23
|
+
})
|
|
24
|
+
mapped_level_id: string;
|
|
25
|
+
|
|
26
|
+
@Column({ name: 'mapped_level_type', type: 'varchar', nullable: true })
|
|
27
|
+
mapped_level_type: string;
|
|
17
28
|
}
|
|
@@ -11,13 +11,17 @@ export class LayoutPreferenceRepository {
|
|
|
11
11
|
) {}
|
|
12
12
|
|
|
13
13
|
async findByEntityUserId(
|
|
14
|
-
|
|
14
|
+
mapped_entity_type: string,
|
|
15
|
+
mapped_level_id: string,
|
|
16
|
+
mapped_level_type: string,
|
|
15
17
|
userId: number,
|
|
16
18
|
): Promise<LayoutPreference | null> {
|
|
17
19
|
return this.layoutPreferenceRepo.findOne({
|
|
18
20
|
where: {
|
|
19
21
|
user_id: userId.toString(),
|
|
20
|
-
mapped_entity_type:
|
|
22
|
+
mapped_entity_type: mapped_entity_type,
|
|
23
|
+
mapped_level_id: mapped_level_id,
|
|
24
|
+
mapped_level_type: mapped_level_type,
|
|
21
25
|
},
|
|
22
26
|
});
|
|
23
27
|
}
|
|
@@ -27,6 +27,8 @@ export class LayoutPreferenceService extends EntityServiceImpl {
|
|
|
27
27
|
const existingLayoutPreference =
|
|
28
28
|
await this.layoutPreferenceRepository.findByEntityUserId(
|
|
29
29
|
mapped_entity_type,
|
|
30
|
+
loggedInUser.level_id,
|
|
31
|
+
loggedInUser.level_type,
|
|
30
32
|
userId,
|
|
31
33
|
);
|
|
32
34
|
|
|
@@ -38,16 +40,31 @@ export class LayoutPreferenceService extends EntityServiceImpl {
|
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
return await super.createEntity(
|
|
41
|
-
{
|
|
43
|
+
{
|
|
44
|
+
...entityData,
|
|
45
|
+
user_id: userId,
|
|
46
|
+
mapped_level_id: loggedInUser.level_id,
|
|
47
|
+
mapped_level_type: loggedInUser.level_type,
|
|
48
|
+
} as any,
|
|
42
49
|
loggedInUser,
|
|
43
50
|
);
|
|
44
51
|
}
|
|
45
52
|
|
|
46
|
-
async getLayoutPreferenceByUserID(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
async getLayoutPreferenceByUserID(
|
|
54
|
+
user_id,
|
|
55
|
+
mapped_entity_type,
|
|
56
|
+
mapped_level_id,
|
|
57
|
+
mapped_level_type,
|
|
58
|
+
) {
|
|
59
|
+
const layoutPreference =
|
|
60
|
+
await this.layoutPreferenceRepository.findByEntityUserId(
|
|
61
|
+
mapped_entity_type,
|
|
62
|
+
mapped_level_id,
|
|
63
|
+
mapped_level_type,
|
|
64
|
+
user_id,
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
return layoutPreference;
|
|
51
68
|
}
|
|
52
69
|
|
|
53
70
|
async getColumnValue(
|
|
@@ -65,6 +82,7 @@ export class LayoutPreferenceService extends EntityServiceImpl {
|
|
|
65
82
|
);
|
|
66
83
|
|
|
67
84
|
const tableName = getTableMeta?.data_source;
|
|
85
|
+
|
|
68
86
|
if (!tableName) {
|
|
69
87
|
throw new Error('Invalid or missing table name in metadata');
|
|
70
88
|
}
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Body,
|
|
3
3
|
Controller,
|
|
4
|
+
Get,
|
|
4
5
|
HttpStatus,
|
|
6
|
+
Param,
|
|
5
7
|
Post,
|
|
8
|
+
Req,
|
|
6
9
|
Res,
|
|
7
|
-
Get,
|
|
8
|
-
Param,
|
|
9
10
|
UseGuards,
|
|
10
|
-
Req,
|
|
11
11
|
} from '@nestjs/common';
|
|
12
|
-
import {
|
|
12
|
+
import { Response } from 'express';
|
|
13
13
|
import { JwtAuthGuard } from '../../auth/guards/jwt.guard';
|
|
14
|
-
import
|
|
15
|
-
import { ENTITYTYPE_MEDIA } from 'src/constant/global.constant';
|
|
16
|
-
import { MediaData } from '../entity/media-data.entity';
|
|
14
|
+
import { MediaDataService } from '../service/media-data.service';
|
|
17
15
|
|
|
18
16
|
@Controller('media')
|
|
19
17
|
@UseGuards(JwtAuthGuard)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Body,
|
|
3
|
+
Controller,
|
|
4
|
+
HttpCode,
|
|
5
|
+
HttpStatus,
|
|
6
|
+
Inject,
|
|
7
|
+
Post,
|
|
8
|
+
Req,
|
|
9
|
+
UseGuards,
|
|
10
|
+
} from '@nestjs/common';
|
|
11
|
+
import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard';
|
|
12
|
+
import { ActionCategoryService } from '../service/action-category.service';
|
|
13
|
+
|
|
14
|
+
@Controller('/actionCategory')
|
|
15
|
+
@UseGuards(JwtAuthGuard)
|
|
16
|
+
export class ActionCategoryController {
|
|
17
|
+
constructor(
|
|
18
|
+
@Inject('ActionCategoryService')
|
|
19
|
+
private readonly actionCategoryService: ActionCategoryService,
|
|
20
|
+
) {}
|
|
21
|
+
|
|
22
|
+
@Post('/getActionsCategory')
|
|
23
|
+
@HttpCode(HttpStatus.OK)
|
|
24
|
+
async getActionsCat(
|
|
25
|
+
@Req() req: Request & { user: any },
|
|
26
|
+
@Body('entity_type') entity_type: string,
|
|
27
|
+
) {
|
|
28
|
+
const loggedInUser = req.user.userData;
|
|
29
|
+
const result = this.actionCategoryService.getActionsCat(
|
|
30
|
+
loggedInUser,
|
|
31
|
+
entity_type,
|
|
32
|
+
);
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -46,10 +46,10 @@ export class ActionController {
|
|
|
46
46
|
@HttpCode(HttpStatus.OK)
|
|
47
47
|
async getActions(
|
|
48
48
|
@Req() req: Request & { user: any },
|
|
49
|
-
@Body('
|
|
49
|
+
@Body('stage_id') stage_id: number,
|
|
50
50
|
) {
|
|
51
51
|
const loggedInUser = req.user.userData;
|
|
52
|
-
const result = this.actionService.getActions(loggedInUser,
|
|
52
|
+
const result = this.actionService.getActions(loggedInUser, stage_id);
|
|
53
53
|
return result;
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
+
Body,
|
|
2
3
|
Controller,
|
|
3
|
-
Get,
|
|
4
4
|
HttpCode,
|
|
5
5
|
HttpStatus,
|
|
6
|
+
Post,
|
|
6
7
|
Query,
|
|
7
8
|
Req,
|
|
8
9
|
UseGuards,
|
|
@@ -15,15 +16,15 @@ import { CommTemplateService } from '../service/comm-template.service';
|
|
|
15
16
|
export class CommTemplateController {
|
|
16
17
|
constructor(private readonly commTemplateService: CommTemplateService) {}
|
|
17
18
|
|
|
18
|
-
@
|
|
19
|
+
@Post('/getTemplates')
|
|
19
20
|
@HttpCode(HttpStatus.OK)
|
|
20
21
|
async getTemplate(
|
|
21
22
|
@Req() req: Request & { user: any },
|
|
22
|
-
@
|
|
23
|
+
@Body('entity_type') entity_type: string,
|
|
23
24
|
) {
|
|
24
25
|
const loggedInUser = req.user.userData;
|
|
25
26
|
const result = this.commTemplateService.getAllCommTemplate(
|
|
26
|
-
|
|
27
|
+
entity_type || '',
|
|
27
28
|
loggedInUser,
|
|
28
29
|
);
|
|
29
30
|
return result;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Controller, Get, Query, Post, Body } from '@nestjs/common';
|
|
2
|
+
import { WorkflowMetaService } from '../service/workflow-meta.service';
|
|
3
|
+
import { StageMovementData } from '../entity/stage-movement-data.entity';
|
|
4
|
+
|
|
5
|
+
@Controller('workflow-meta')
|
|
6
|
+
export class WorkflowMetaController {
|
|
7
|
+
constructor(private readonly workflowMetaService: WorkflowMetaService) {}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* GET /meta/current-stage?entityType=...&entityId=...
|
|
11
|
+
*/
|
|
12
|
+
@Get('current-stage')
|
|
13
|
+
async getCurrentStage(
|
|
14
|
+
@Query('entityType') mapped_entity_type: string,
|
|
15
|
+
@Query('entityId') mapped_entity_id: number,
|
|
16
|
+
): Promise<StageMovementData | null> {
|
|
17
|
+
return this.workflowMetaService.getCurrentStage(mapped_entity_type, Number(mapped_entity_id));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* GET /meta/next-stage?entityType=...&entityId=...
|
|
22
|
+
*/
|
|
23
|
+
@Get('next-stage')
|
|
24
|
+
async getNextStage(
|
|
25
|
+
@Query('entityType') mapped_entity_type: string,
|
|
26
|
+
@Query('entityId') mapped_entity_id: number,
|
|
27
|
+
): Promise<number | null> {
|
|
28
|
+
const current = await this.workflowMetaService.getCurrentStage(mapped_entity_type, Number(mapped_entity_id));
|
|
29
|
+
return current ? this.workflowMetaService.getNextStage(current) : null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* POST /meta/move-next-stage
|
|
34
|
+
* {
|
|
35
|
+
* "entityType": "lead",
|
|
36
|
+
* "entityId": 101,
|
|
37
|
+
* "currentUserId": 5
|
|
38
|
+
* }
|
|
39
|
+
*/
|
|
40
|
+
@Post('move-next-stage')
|
|
41
|
+
async moveToNextStage(
|
|
42
|
+
@Body('entityType') mapped_entity_type: string,
|
|
43
|
+
@Body('entityId') mapped_entity_id: number,
|
|
44
|
+
@Body('currentUserId') current_user_id: number,
|
|
45
|
+
): Promise<string> {
|
|
46
|
+
return this.workflowMetaService.moveToNextStage(
|
|
47
|
+
mapped_entity_type,
|
|
48
|
+
Number(mapped_entity_id),
|
|
49
|
+
current_user_id,
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
} from '@nestjs/common';
|
|
15
15
|
import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard';
|
|
16
16
|
import { WorkflowService } from '../service/workflow.service';
|
|
17
|
+
import { PopulateWorkflowService } from '../service/populate-workflow.service';
|
|
17
18
|
|
|
18
19
|
@Controller('/workflow')
|
|
19
20
|
@UseGuards(JwtAuthGuard)
|
|
@@ -21,6 +22,7 @@ export class WorkflowController {
|
|
|
21
22
|
constructor(
|
|
22
23
|
@Inject('WorkflowService')
|
|
23
24
|
private readonly workflowService: WorkflowService,
|
|
25
|
+
private readonly populateWorkflowService: PopulateWorkflowService,
|
|
24
26
|
) {}
|
|
25
27
|
|
|
26
28
|
@Post('/getAllWorkflows')
|
|
@@ -50,4 +52,16 @@ export class WorkflowController {
|
|
|
50
52
|
const loggedInUser = req.user?.userData;
|
|
51
53
|
return this.workflowService.updateSequence(body, loggedInUser);
|
|
52
54
|
}
|
|
55
|
+
|
|
56
|
+
@Post('/populateWorkflow')
|
|
57
|
+
async populateWorkflow(
|
|
58
|
+
@Body() body: any,
|
|
59
|
+
@Req() req: Request & { user: any },
|
|
60
|
+
) {
|
|
61
|
+
const loggedInUser = req.user?.userData;
|
|
62
|
+
return this.populateWorkflowService.populateWorkflowData(
|
|
63
|
+
body.organization_id,
|
|
64
|
+
loggedInUser,
|
|
65
|
+
);
|
|
66
|
+
}
|
|
53
67
|
}
|
|
@@ -19,13 +19,13 @@ export class ActionEntity extends BaseEntity {
|
|
|
19
19
|
action_requirement: string;
|
|
20
20
|
|
|
21
21
|
@Column({ type: 'varchar', nullable: true })
|
|
22
|
-
|
|
22
|
+
sequence: string;
|
|
23
23
|
|
|
24
24
|
@Column({ type: 'varchar', nullable: true })
|
|
25
25
|
reason_code: string;
|
|
26
26
|
|
|
27
|
-
@Column({ type: '
|
|
28
|
-
default_reason_code:
|
|
27
|
+
@Column({ type: 'int', nullable: true })
|
|
28
|
+
default_reason_code: number;
|
|
29
29
|
|
|
30
30
|
@Column({ default: 0, type: 'boolean' })
|
|
31
31
|
default_value: boolean;
|
|
@@ -9,6 +9,23 @@ export class CommTemplate extends BaseEntity {
|
|
|
9
9
|
this.entity_type = COMM_TEMPLATE;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
@Column({
|
|
12
|
+
@Column({ nullable: true })
|
|
13
13
|
mode: string;
|
|
14
|
+
|
|
15
|
+
@Column({ type: 'varchar', nullable: true })
|
|
16
|
+
mapped_entity_type: string;
|
|
17
|
+
|
|
18
|
+
@Column({ nullable: true })
|
|
19
|
+
subject: string;
|
|
20
|
+
|
|
21
|
+
@Column({ nullable: true })
|
|
22
|
+
format_type: string;
|
|
23
|
+
|
|
24
|
+
// if format_type is 'richtext', this field will be used
|
|
25
|
+
@Column({ type: 'longtext', nullable: true })
|
|
26
|
+
rich_text: string;
|
|
27
|
+
|
|
28
|
+
// if format_type is 'markup', this field will be used
|
|
29
|
+
@Column({ nullable: true })
|
|
30
|
+
markup_id: number;
|
|
14
31
|
}
|
|
@@ -23,4 +23,10 @@ export class StageMovementData extends BaseEntity {
|
|
|
23
23
|
|
|
24
24
|
@Column({ type: 'varchar', nullable: true })
|
|
25
25
|
is_current: string;
|
|
26
|
+
|
|
27
|
+
@Column({ type: 'varchar', nullable: true })
|
|
28
|
+
mapped_entity_type: string;
|
|
29
|
+
|
|
30
|
+
@Column({ type: 'int', nullable: true })
|
|
31
|
+
mapped_entity_id: number;
|
|
26
32
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
|
2
|
+
|
|
3
|
+
@Entity({ name: 'cr_wf_tem_attach_mapper' })
|
|
4
|
+
export class TemplateAttach {
|
|
5
|
+
constructor() {}
|
|
6
|
+
|
|
7
|
+
@PrimaryGeneratedColumn()
|
|
8
|
+
id: number;
|
|
9
|
+
|
|
10
|
+
@Column({})
|
|
11
|
+
entity_type: string;
|
|
12
|
+
|
|
13
|
+
@Column({ nullable: true })
|
|
14
|
+
template_id: number;
|
|
15
|
+
|
|
16
|
+
@Column({ nullable: true })
|
|
17
|
+
media_id: number;
|
|
18
|
+
|
|
19
|
+
@Column({ nullable: true })
|
|
20
|
+
organization_id: number;
|
|
21
|
+
|
|
22
|
+
@Column({ nullable: true })
|
|
23
|
+
appcode: string;
|
|
24
|
+
|
|
25
|
+
@Column({ nullable: true })
|
|
26
|
+
level_id: string;
|
|
27
|
+
|
|
28
|
+
@Column({ nullable: true })
|
|
29
|
+
level_type: string;
|
|
30
|
+
}
|
|
@@ -3,32 +3,56 @@ import { InjectRepository } from '@nestjs/typeorm';
|
|
|
3
3
|
import { Workflow } from '../entity/workflow.entity';
|
|
4
4
|
import { Repository } from 'typeorm';
|
|
5
5
|
import { CommTemplate } from '../entity/comm-template.entity';
|
|
6
|
+
import { TemplateAttach } from '../entity/template-attach-mapper.entity';
|
|
7
|
+
import { MediaDataService } from 'src/module/meta/service/media-data.service';
|
|
6
8
|
|
|
7
9
|
@Injectable()
|
|
8
10
|
export class CommTemplateRepository {
|
|
9
11
|
constructor(
|
|
10
12
|
@InjectRepository(CommTemplate)
|
|
11
13
|
private readonly commTemplateRepository: Repository<CommTemplate>,
|
|
14
|
+
@InjectRepository(TemplateAttach)
|
|
15
|
+
private readonly templateAttachEntity: Repository<TemplateAttach>,
|
|
16
|
+
private readonly mediaDataService: MediaDataService,
|
|
12
17
|
) {}
|
|
13
18
|
|
|
14
19
|
async getAllCommTemplate(entity_type: string, loggedInUser) {
|
|
20
|
+
const { organization_id } = loggedInUser;
|
|
15
21
|
return this.commTemplateRepository.find({
|
|
16
22
|
select: ['name', 'code'],
|
|
17
23
|
where: {
|
|
18
|
-
|
|
24
|
+
mapped_entity_type: entity_type,
|
|
25
|
+
organization_id: organization_id,
|
|
19
26
|
},
|
|
20
27
|
});
|
|
21
28
|
}
|
|
22
29
|
|
|
30
|
+
async save(commTemplate: any): Promise<any> {
|
|
31
|
+
// // delete existing mapper
|
|
32
|
+
// for (const attachment of commTemplate || []) {
|
|
33
|
+
// await this.templateAttachEntity.delete({
|
|
34
|
+
// entity_type: attachment.entity_type,
|
|
35
|
+
// template_id: attachment.template_id,
|
|
36
|
+
// });
|
|
37
|
+
// }
|
|
38
|
+
|
|
39
|
+
return this.templateAttachEntity.save(commTemplate);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async delete(id: any): Promise<any> {
|
|
43
|
+
// delete existing mapper
|
|
44
|
+
return await this.templateAttachEntity.delete(id);
|
|
45
|
+
}
|
|
46
|
+
|
|
23
47
|
async getTemplateByCode(
|
|
24
48
|
entity_type: string,
|
|
25
49
|
code: string,
|
|
26
50
|
loggedInUser,
|
|
27
|
-
): Promise<
|
|
51
|
+
): Promise<any | null> {
|
|
28
52
|
const template = await this.commTemplateRepository.findOne({
|
|
29
53
|
where: {
|
|
30
|
-
entity_type
|
|
31
|
-
code
|
|
54
|
+
entity_type,
|
|
55
|
+
code,
|
|
32
56
|
},
|
|
33
57
|
});
|
|
34
58
|
|
|
@@ -36,6 +60,35 @@ export class CommTemplateRepository {
|
|
|
36
60
|
throw new NotFoundException(`Template with code ${code} not found`);
|
|
37
61
|
}
|
|
38
62
|
|
|
39
|
-
|
|
63
|
+
if (template.format_type === 'markup') {
|
|
64
|
+
const media = await this.mediaDataService.getMediaDownloadUrl(
|
|
65
|
+
template.markup_id,
|
|
66
|
+
loggedInUser,
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
console.log(media);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (template.format_type === 'richtext') {
|
|
73
|
+
return template;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Get only attachment IDs
|
|
77
|
+
const attachments = await this.templateAttachEntity.find({
|
|
78
|
+
select: ['media_id'],
|
|
79
|
+
where: {
|
|
80
|
+
entity_type: entity_type,
|
|
81
|
+
template_id: template.id,
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
const media = await this.mediaDataService.getMediaDownloadUrl(
|
|
86
|
+
1,
|
|
87
|
+
loggedInUser,
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
console.log(media);
|
|
91
|
+
|
|
92
|
+
return { ...template, attachments: attachments.map((att) => att.media_id) };
|
|
40
93
|
}
|
|
41
94
|
}
|
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
import { Injectable } from '@nestjs/common';
|
|
2
2
|
import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
|
|
3
|
+
import { UserData } from 'src/module/user/entity/user.entity';
|
|
4
|
+
import { DataSource } from 'typeorm';
|
|
3
5
|
|
|
4
6
|
@Injectable()
|
|
5
|
-
export class ActionCategoryService extends EntityServiceImpl {
|
|
7
|
+
export class ActionCategoryService extends EntityServiceImpl {
|
|
8
|
+
constructor(private readonly dataSource: DataSource) {
|
|
9
|
+
super();
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async getActionsCat(loggedInUser: UserData, entity_type: string) {
|
|
13
|
+
const { organization_id } = loggedInUser;
|
|
14
|
+
|
|
15
|
+
const result = await this.dataSource.query(
|
|
16
|
+
`
|
|
17
|
+
SELECT id, name
|
|
18
|
+
FROM cr_wf_action_category
|
|
19
|
+
WHERE mapped_entity_type = ?
|
|
20
|
+
AND organization_id = ?
|
|
21
|
+
`,
|
|
22
|
+
[entity_type, organization_id],
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
return result.map((row: any) => ({
|
|
26
|
+
label: row.name,
|
|
27
|
+
value: row.id,
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -36,7 +36,7 @@ export class ActionTemplateMappingService extends EntityServiceImpl {
|
|
|
36
36
|
[mode],
|
|
37
37
|
);
|
|
38
38
|
|
|
39
|
-
if (!listMasterItemData?.length) return [];
|
|
39
|
+
if (!listMasterItemData?.length) return [];
|
|
40
40
|
|
|
41
41
|
const templateCodes = templates.map((t) => t.template_code);
|
|
42
42
|
if (!templateCodes.length) return [];
|