rez_core 4.0.184 → 4.0.187
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/app.module.js +11 -0
- package/dist/app.module.js.map +1 -1
- package/dist/config/bull.config.d.ts +10 -0
- package/dist/config/bull.config.js +66 -0
- package/dist/config/bull.config.js.map +1 -0
- package/dist/config/database.config.js +1 -1
- package/dist/config/database.config.js.map +1 -1
- package/dist/module/entity_json/controller/entity_json.controller.d.ts +8 -0
- package/dist/module/entity_json/controller/entity_json.controller.js +43 -0
- package/dist/module/entity_json/controller/entity_json.controller.js.map +1 -0
- package/dist/module/entity_json/entity_json.module.d.ts +2 -0
- package/dist/module/entity_json/entity_json.module.js +26 -0
- package/dist/module/entity_json/entity_json.module.js.map +1 -0
- package/dist/module/entity_json/service/entity_json.service.d.ts +7 -0
- package/dist/module/entity_json/service/entity_json.service.js +116 -0
- package/dist/module/entity_json/service/entity_json.service.js.map +1 -0
- package/dist/module/filter/service/filter.service.js.map +1 -1
- package/dist/module/integration/service/wrapper.service.d.ts +3 -1
- package/dist/module/integration/service/wrapper.service.js +39 -36
- package/dist/module/integration/service/wrapper.service.js.map +1 -1
- package/dist/module/linked_attributes/controller/linked_attributes.controller.d.ts +5 -0
- package/dist/module/linked_attributes/controller/linked_attributes.controller.js +29 -0
- package/dist/module/linked_attributes/controller/linked_attributes.controller.js.map +1 -0
- package/dist/module/linked_attributes/entity/linked_attribute.entity.d.ts +9 -0
- package/dist/module/linked_attributes/entity/linked_attribute.entity.js +70 -0
- package/dist/module/linked_attributes/entity/linked_attribute.entity.js.map +1 -0
- package/dist/module/linked_attributes/linked_attributes.module.d.ts +2 -0
- package/dist/module/linked_attributes/linked_attributes.module.js +29 -0
- package/dist/module/linked_attributes/linked_attributes.module.js.map +1 -0
- package/dist/module/linked_attributes/repository/linked_attribute.repository.d.ts +6 -0
- package/dist/module/linked_attributes/repository/linked_attribute.repository.js +31 -0
- package/dist/module/linked_attributes/repository/linked_attribute.repository.js.map +1 -0
- package/dist/module/linked_attributes/service/linked_attributes.service.d.ts +5 -0
- package/dist/module/linked_attributes/service/linked_attributes.service.js +34 -0
- package/dist/module/linked_attributes/service/linked_attributes.service.js.map +1 -0
- package/dist/module/mapper/service/field-mapper.service.js +2 -2
- package/dist/module/mapper/service/field-mapper.service.js.map +1 -1
- package/dist/module/meta/controller/attribute-master.controller.d.ts +10 -1
- package/dist/module/meta/controller/attribute-master.controller.js +27 -2
- package/dist/module/meta/controller/attribute-master.controller.js.map +1 -1
- package/dist/module/meta/controller/entity-master.controller.d.ts +6 -0
- package/dist/module/meta/controller/entity-master.controller.js +13 -0
- package/dist/module/meta/controller/entity-master.controller.js.map +1 -1
- package/dist/module/meta/entity.module.js +7 -0
- package/dist/module/meta/entity.module.js.map +1 -1
- package/dist/module/meta/repository/attribute-master.repository.d.ts +4 -0
- package/dist/module/meta/repository/attribute-master.repository.js +19 -0
- package/dist/module/meta/repository/attribute-master.repository.js.map +1 -1
- package/dist/module/meta/repository/entity-attribute-update.repository.d.ts +6 -0
- package/dist/module/meta/repository/entity-attribute-update.repository.js +44 -0
- package/dist/module/meta/repository/entity-attribute-update.repository.js.map +1 -0
- package/dist/module/meta/repository/entity-master.repository.d.ts +7 -1
- package/dist/module/meta/repository/entity-master.repository.js +24 -2
- package/dist/module/meta/repository/entity-master.repository.js.map +1 -1
- package/dist/module/meta/service/attribute-master.service.d.ts +4 -0
- package/dist/module/meta/service/attribute-master.service.js +3 -0
- package/dist/module/meta/service/attribute-master.service.js.map +1 -1
- package/dist/module/meta/service/entity-attribute-update.service.d.ts +7 -0
- package/dist/module/meta/service/entity-attribute-update.service.js +35 -0
- package/dist/module/meta/service/entity-attribute-update.service.js.map +1 -0
- package/dist/module/meta/service/entity-master.service.d.ts +4 -0
- package/dist/module/meta/service/entity-master.service.js +3 -0
- package/dist/module/meta/service/entity-master.service.js.map +1 -1
- package/dist/module/meta/service/resolver.service.js +2 -2
- package/dist/module/meta/service/resolver.service.js.map +1 -1
- package/dist/module/module/service/module-access.service.js +1 -7
- package/dist/module/module/service/module-access.service.js.map +1 -1
- package/dist/module/workflow/entity/action.entity.d.ts +1 -0
- package/dist/module/workflow/entity/action.entity.js +4 -0
- package/dist/module/workflow/entity/action.entity.js.map +1 -1
- package/dist/module/workflow/repository/action-data.repository.js +1 -0
- package/dist/module/workflow/repository/action-data.repository.js.map +1 -1
- package/dist/module/workflow/repository/task.repository.d.ts +3 -1
- package/dist/module/workflow/repository/task.repository.js +6 -1
- package/dist/module/workflow/repository/task.repository.js.map +1 -1
- package/dist/module/workflow/service/task.service.js +41 -27
- package/dist/module/workflow/service/task.service.js.map +1 -1
- package/dist/module/workflow/service/workflow-meta.service.js +23 -21
- package/dist/module/workflow/service/workflow-meta.service.js.map +1 -1
- package/dist/module/workflow-automation/controller/workflow-automation.controller.d.ts +6 -0
- package/dist/module/workflow-automation/controller/workflow-automation.controller.js +16 -0
- package/dist/module/workflow-automation/controller/workflow-automation.controller.js.map +1 -1
- package/dist/module/workflow-automation/entity/workflow-automation.entity.d.ts +2 -0
- package/dist/module/workflow-automation/entity/workflow-automation.entity.js +8 -0
- package/dist/module/workflow-automation/entity/workflow-automation.entity.js.map +1 -1
- package/dist/module/workflow-automation/service/schedule-handler.service.d.ts +16 -0
- package/dist/module/workflow-automation/service/schedule-handler.service.js +109 -0
- package/dist/module/workflow-automation/service/schedule-handler.service.js.map +1 -0
- package/dist/module/workflow-automation/service/workflow-automation-engine.service.d.ts +1 -1
- package/dist/module/workflow-automation/service/workflow-automation-engine.service.js.map +1 -1
- package/dist/module/workflow-automation/service/workflow-automation.service.d.ts +13 -1
- package/dist/module/workflow-automation/service/workflow-automation.service.js +111 -2
- package/dist/module/workflow-automation/service/workflow-automation.service.js.map +1 -1
- package/dist/module/workflow-automation/workflow-automation.module.js +14 -1
- package/dist/module/workflow-automation/workflow-automation.module.js.map +1 -1
- package/dist/module/workflow-schedule/constants/schedule.constants.d.ts +27 -0
- package/dist/module/workflow-schedule/constants/schedule.constants.js +31 -0
- package/dist/module/workflow-schedule/constants/schedule.constants.js.map +1 -0
- package/dist/module/workflow-schedule/controller/workflow-schedule.controller.d.ts +83 -0
- package/dist/module/workflow-schedule/controller/workflow-schedule.controller.js +220 -0
- package/dist/module/workflow-schedule/controller/workflow-schedule.controller.js.map +1 -0
- package/dist/module/workflow-schedule/dto/create-schedule.dto.d.ts +32 -0
- package/dist/module/workflow-schedule/dto/create-schedule.dto.js +163 -0
- package/dist/module/workflow-schedule/dto/create-schedule.dto.js.map +1 -0
- package/dist/module/workflow-schedule/dto/get-execution-logs.dto.d.ts +35 -0
- package/dist/module/workflow-schedule/dto/get-execution-logs.dto.js +124 -0
- package/dist/module/workflow-schedule/dto/get-execution-logs.dto.js.map +1 -0
- package/dist/module/workflow-schedule/dto/update-schedule.dto.d.ts +19 -0
- package/dist/module/workflow-schedule/dto/update-schedule.dto.js +106 -0
- package/dist/module/workflow-schedule/dto/update-schedule.dto.js.map +1 -0
- package/dist/module/workflow-schedule/entities/scheduled-workflow.entity.d.ts +30 -0
- package/dist/module/workflow-schedule/entities/scheduled-workflow.entity.js +113 -0
- package/dist/module/workflow-schedule/entities/scheduled-workflow.entity.js.map +1 -0
- package/dist/module/workflow-schedule/entities/workflow-execution-log.entity.d.ts +34 -0
- package/dist/module/workflow-schedule/entities/workflow-execution-log.entity.js +118 -0
- package/dist/module/workflow-schedule/entities/workflow-execution-log.entity.js.map +1 -0
- package/dist/module/workflow-schedule/interfaces/schedule-job-data.interface.d.ts +44 -0
- package/dist/module/workflow-schedule/interfaces/schedule-job-data.interface.js +3 -0
- package/dist/module/workflow-schedule/interfaces/schedule-job-data.interface.js.map +1 -0
- package/dist/module/workflow-schedule/interfaces/workflow-schedule-options.interface.d.ts +3 -0
- package/dist/module/workflow-schedule/interfaces/workflow-schedule-options.interface.js +3 -0
- package/dist/module/workflow-schedule/interfaces/workflow-schedule-options.interface.js.map +1 -0
- package/dist/module/workflow-schedule/processors/schedule.processor.d.ts +31 -0
- package/dist/module/workflow-schedule/processors/schedule.processor.js +409 -0
- package/dist/module/workflow-schedule/processors/schedule.processor.js.map +1 -0
- package/dist/module/workflow-schedule/service/workflow-schedule.service.d.ts +44 -0
- package/dist/module/workflow-schedule/service/workflow-schedule.service.js +434 -0
- package/dist/module/workflow-schedule/service/workflow-schedule.service.js.map +1 -0
- package/dist/module/workflow-schedule/workflow-schedule.module.d.ts +5 -0
- package/dist/module/workflow-schedule/workflow-schedule.module.js +52 -0
- package/dist/module/workflow-schedule/workflow-schedule.module.js.map +1 -0
- package/dist/table.config.d.ts +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/service/loggingUtil.service.d.ts +9 -2
- package/dist/utils/service/loggingUtil.service.js +65 -14
- package/dist/utils/service/loggingUtil.service.js.map +1 -1
- package/dist/utils/utils.module.js +2 -0
- package/dist/utils/utils.module.js.map +1 -1
- package/package.json +9 -4
- package/src/app.module.ts +16 -2
- package/src/config/bull.config.ts +69 -0
- package/src/config/database.config.ts +1 -1
- package/src/module/entity_json/controller/entity_json.controller.ts +47 -0
- package/src/module/entity_json/entity_json.module.ts +13 -0
- package/src/module/entity_json/service/entity_json.service.ts +162 -0
- package/src/module/filter/service/filter.service.ts +0 -2
- package/src/module/integration/service/wrapper.service.ts +248 -41
- package/src/module/linked_attributes/controller/linked_attributes.controller.ts +10 -0
- package/src/module/linked_attributes/entity/linked_attribute.entity.ts +48 -0
- package/src/module/linked_attributes/linked_attributes.module.ts +16 -0
- package/src/module/linked_attributes/repository/linked_attribute.repository.ts +12 -0
- package/src/module/linked_attributes/service/linked_attributes.service.ts +22 -0
- package/src/module/mapper/service/field-mapper.service.ts +12 -7
- package/src/module/meta/controller/attribute-master.controller.ts +20 -0
- package/src/module/meta/controller/entity-master.controller.ts +13 -0
- package/src/module/meta/entity.module.ts +8 -0
- package/src/module/meta/repository/attribute-master.repository.ts +20 -0
- package/src/module/meta/repository/entity-attribute-update.repository.ts +44 -0
- package/src/module/meta/repository/entity-master.repository.ts +30 -0
- package/src/module/meta/service/attribute-master.service.ts +4 -0
- package/src/module/meta/service/entity-attribute-update.service.ts +29 -0
- package/src/module/meta/service/entity-master.service.ts +6 -0
- package/src/module/meta/service/resolver.service.ts +2 -2
- package/src/module/module/service/module-access.service.ts +3 -16
- package/src/module/workflow/entity/action.entity.ts +3 -0
- package/src/module/workflow/repository/action-data.repository.ts +1 -0
- package/src/module/workflow/repository/task.repository.ts +8 -0
- package/src/module/workflow/service/task.service.ts +47 -38
- package/src/module/workflow/service/workflow-meta.service.ts +47 -33
- package/src/module/workflow-automation/SCHEDULING_GUIDE.md +145 -0
- package/src/module/workflow-automation/controller/workflow-automation.controller.ts +22 -0
- package/src/module/workflow-automation/entity/workflow-automation.entity.ts +5 -0
- package/src/module/workflow-automation/service/schedule-handler.service.ts +149 -0
- package/src/module/workflow-automation/service/workflow-automation-engine.service.ts +1 -1
- package/src/module/workflow-automation/service/workflow-automation.service.ts +163 -2
- package/src/module/workflow-automation/workflow-automation.module.ts +14 -1
- package/src/module/workflow-schedule/INSTALLATION.md +244 -0
- package/src/module/workflow-schedule/MULTI_PROJECT_GUIDE.md +196 -0
- package/src/module/workflow-schedule/README.md +422 -0
- package/src/module/workflow-schedule/constants/schedule.constants.ts +48 -0
- package/src/module/workflow-schedule/controller/workflow-schedule.controller.ts +255 -0
- package/src/module/workflow-schedule/docs/CLAUDE_CODE_GUIDE.md +510 -0
- package/src/module/workflow-schedule/docs/CLAUDE_CODE_PROMPT.md +362 -0
- package/src/module/workflow-schedule/docs/RUN_CLAUDE_CODE.sh +68 -0
- package/src/module/workflow-schedule/dto/create-schedule.dto.ts +147 -0
- package/src/module/workflow-schedule/dto/get-execution-logs.dto.ts +119 -0
- package/src/module/workflow-schedule/dto/update-schedule.dto.ts +96 -0
- package/src/module/workflow-schedule/entities/scheduled-workflow.entity.ts +148 -0
- package/src/module/workflow-schedule/entities/workflow-execution-log.entity.ts +154 -0
- package/src/module/workflow-schedule/interfaces/schedule-job-data.interface.ts +53 -0
- package/src/module/workflow-schedule/interfaces/workflow-schedule-options.interface.ts +12 -0
- package/src/module/workflow-schedule/processors/schedule.processor.ts +584 -0
- package/src/module/workflow-schedule/service/workflow-schedule.service.ts +600 -0
- package/src/module/workflow-schedule/workflow-schedule.module.ts +67 -0
- package/src/resources/dev.properties.yaml +1 -1
- package/src/utils/service/loggingUtil.service.ts +70 -16
- package/src/utils/utils.module.ts +2 -0
|
@@ -10,12 +10,14 @@ import {
|
|
|
10
10
|
import { Request } from 'express';
|
|
11
11
|
import { AttributeMasterService } from '../service/attribute-master.service';
|
|
12
12
|
import { JwtAuthGuard } from '../../auth/guards/jwt.guard';
|
|
13
|
+
import { EntityUpdateService } from '../service/entity-attribute-update.service';
|
|
13
14
|
|
|
14
15
|
@Controller('attribute-master')
|
|
15
16
|
@UseGuards(JwtAuthGuard)
|
|
16
17
|
export class AttributeMasterController {
|
|
17
18
|
constructor(
|
|
18
19
|
private readonly attributeMasterService: AttributeMasterService,
|
|
20
|
+
private readonly entityUpdateService: EntityUpdateService,
|
|
19
21
|
) {}
|
|
20
22
|
|
|
21
23
|
@Post('/create')
|
|
@@ -30,6 +32,12 @@ export class AttributeMasterController {
|
|
|
30
32
|
);
|
|
31
33
|
}
|
|
32
34
|
|
|
35
|
+
@Post('/updateAttributeValue')
|
|
36
|
+
async entityAttributeUpdate (@Body() payload:{}){
|
|
37
|
+
return this.entityUpdateService.execute(payload);
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
|
|
33
41
|
@Post('update/:id')
|
|
34
42
|
async updateAttribute(
|
|
35
43
|
@Body() attributeData: any,
|
|
@@ -52,6 +60,18 @@ export class AttributeMasterController {
|
|
|
52
60
|
return await this.attributeMasterService.getAttributeById(id);
|
|
53
61
|
}
|
|
54
62
|
|
|
63
|
+
@Get('getAttributeDropdownByEntity/:entity_type')
|
|
64
|
+
async getAttributeByEntity(
|
|
65
|
+
@Param('entity_type') entity_type:string,
|
|
66
|
+
@Req() req: Request & { user: any },
|
|
67
|
+
){
|
|
68
|
+
|
|
69
|
+
const loggedInUser = req.user.userData;
|
|
70
|
+
|
|
71
|
+
return await this.attributeMasterService.getAttributesByEntityType(entity_type,loggedInUser)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
|
|
55
75
|
@Get('getDropdownList/:entityType')
|
|
56
76
|
async getAttributesDropdownList(
|
|
57
77
|
@Param('entityType') entityType: string,
|
|
@@ -25,4 +25,17 @@ export class EntityMasterController {
|
|
|
25
25
|
) {
|
|
26
26
|
return await this.entityMasterService.getEntityById(id);
|
|
27
27
|
}
|
|
28
|
+
|
|
29
|
+
@Get('getAllEntityRealationDropdown/:entity_type')
|
|
30
|
+
@HttpCode(HttpStatus.OK)
|
|
31
|
+
async getAllEntity(
|
|
32
|
+
@Param('entity_type') entity_type: string,
|
|
33
|
+
@Req() req: Request & { user: any },
|
|
34
|
+
) {
|
|
35
|
+
|
|
36
|
+
const loggedInUser = req.user.userData;
|
|
37
|
+
|
|
38
|
+
// console.log(loggedInUser);
|
|
39
|
+
return await this.entityMasterService.getAllEntityDropDown(entity_type,loggedInUser)
|
|
40
|
+
}
|
|
28
41
|
}
|
|
@@ -60,6 +60,8 @@ import { EntityMasterRepository } from './repository/entity-master.repository';
|
|
|
60
60
|
import { EntityMasterController } from './controller/entity-master.controller';
|
|
61
61
|
import { WorkflowAutomationModule } from '../workflow-automation/workflow-automation.module';
|
|
62
62
|
import { EntityPublicController } from './controller/entity.public.controller';
|
|
63
|
+
import { EntityUpdateService } from './service/entity-attribute-update.service';
|
|
64
|
+
import { EntityUpdateRepository } from './repository/entity-attribute-update.repository';
|
|
63
65
|
|
|
64
66
|
@Module({
|
|
65
67
|
imports: [
|
|
@@ -75,11 +77,13 @@ import { EntityPublicController } from './controller/entity.public.controller';
|
|
|
75
77
|
AppMaster,
|
|
76
78
|
EntityRelation,
|
|
77
79
|
EntityRelationData,
|
|
80
|
+
EntityUpdateService
|
|
78
81
|
]),
|
|
79
82
|
forwardRef(() => ListMasterModule),
|
|
80
83
|
forwardRef(() => FilterModule),
|
|
81
84
|
UtilsModule,
|
|
82
85
|
WorkflowAutomationModule,
|
|
86
|
+
|
|
83
87
|
],
|
|
84
88
|
providers: [
|
|
85
89
|
EntityMasterService,
|
|
@@ -87,6 +91,7 @@ import { EntityPublicController } from './controller/entity.public.controller';
|
|
|
87
91
|
EntityDynamicService,
|
|
88
92
|
{ provide: 'CommonService', useClass: CommonService },
|
|
89
93
|
AttributeMasterRepository,
|
|
94
|
+
EntityUpdateRepository,
|
|
90
95
|
PreferenceService,
|
|
91
96
|
PreferenceRepository,
|
|
92
97
|
MasterService,
|
|
@@ -99,6 +104,7 @@ import { EntityPublicController } from './controller/entity.public.controller';
|
|
|
99
104
|
MediaDataRepository,
|
|
100
105
|
MediaDataService,
|
|
101
106
|
AttributeMasterService,
|
|
107
|
+
EntityUpdateService,
|
|
102
108
|
// SectionMasterService,
|
|
103
109
|
// FieldGroupService,
|
|
104
110
|
ViewMaterRespository,
|
|
@@ -128,6 +134,8 @@ import { EntityPublicController } from './controller/entity.public.controller';
|
|
|
128
134
|
PopulateMetaService,
|
|
129
135
|
EntityTableColumnService,
|
|
130
136
|
MediaDataService,
|
|
137
|
+
EntityUpdateService,
|
|
138
|
+
EntityUpdateRepository,
|
|
131
139
|
// SectionMasterService,
|
|
132
140
|
// FieldGroupService,
|
|
133
141
|
'ViewMasterService',
|
|
@@ -59,6 +59,26 @@ export class AttributeMasterRepository {
|
|
|
59
59
|
return await this.attributeMasterRepository.findOne({ where: { id } });
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
async getAllAttributeByEntity(entity_type:string,loggedInUser):Promise<{ label: string; value: any }[]> {
|
|
63
|
+
let data = await this.attributeMasterRepository.find({
|
|
64
|
+
where: {
|
|
65
|
+
organization_id: loggedInUser.organization_id,
|
|
66
|
+
mapped_entity_type: entity_type
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
if(data) {
|
|
70
|
+
const dropdownData = data.map((attribute) => {
|
|
71
|
+
return {"label": attribute.name,
|
|
72
|
+
"value":attribute.attribute_key,
|
|
73
|
+
"data_type":attribute.data_type,
|
|
74
|
+
"data_source_list":attribute.datasource_list
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
return dropdownData;
|
|
79
|
+
}
|
|
80
|
+
return []; }
|
|
81
|
+
|
|
62
82
|
async getAttributesDropdownList(
|
|
63
83
|
entityType: string,
|
|
64
84
|
loggedInUser: UserData,
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { DataSource } from 'typeorm';
|
|
3
|
+
|
|
4
|
+
@Injectable()
|
|
5
|
+
export class EntityUpdateRepository {
|
|
6
|
+
constructor(private readonly dataSource: DataSource) {}
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
async updateEntityAttribute(entity, config ) {
|
|
10
|
+
const {entityType, organization_id} = entity;
|
|
11
|
+
|
|
12
|
+
// 1. Get the table name
|
|
13
|
+
|
|
14
|
+
const result = await this.dataSource.query(
|
|
15
|
+
`SELECT db_table_name
|
|
16
|
+
FROM frm_entity_master
|
|
17
|
+
WHERE mapped_entity_type = ?
|
|
18
|
+
and organization_id = ?`,
|
|
19
|
+
[config.entity_type, organization_id],
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
if (!result.length) {
|
|
23
|
+
throw new Error("Entity table not found");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const entityTableName = result[0].db_table_name;
|
|
27
|
+
|
|
28
|
+
// 2. Determine the ID condition
|
|
29
|
+
|
|
30
|
+
const isLead = config.entity_type === "LEAD";
|
|
31
|
+
const idColumn = isLead ? "id" : "parent_id";
|
|
32
|
+
|
|
33
|
+
// 3. Update using dynamic table name
|
|
34
|
+
|
|
35
|
+
return await this.dataSource
|
|
36
|
+
.createQueryBuilder()
|
|
37
|
+
.update(entityTableName)
|
|
38
|
+
.set({ [config.attribute_key]: config.attribute_value })
|
|
39
|
+
.where(`${idColumn} = :id`, { id: entity.id })
|
|
40
|
+
.execute();
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
}
|
|
@@ -3,6 +3,8 @@ import { EntityMaster } from '../entity/entity-master.entity';
|
|
|
3
3
|
import { InjectRepository } from '@nestjs/typeorm';
|
|
4
4
|
import { Repository, DataSource } from 'typeorm';
|
|
5
5
|
import { ListMasterService } from 'src/module/listmaster/service/list-master.service';
|
|
6
|
+
import { EntityRelationService } from '../service/entity-relation.service';
|
|
7
|
+
import { EntityRelation } from '../entity/entity-relation.entity';
|
|
6
8
|
|
|
7
9
|
@Injectable()
|
|
8
10
|
export class EntityMasterRepository {
|
|
@@ -12,6 +14,8 @@ export class EntityMasterRepository {
|
|
|
12
14
|
private readonly dataSource: DataSource,
|
|
13
15
|
@Inject('ListMasterService')
|
|
14
16
|
private readonly listMasterService: ListMasterService,
|
|
17
|
+
@InjectRepository(EntityRelation)
|
|
18
|
+
private readonly entityRelationRepo: Repository<EntityRelation>
|
|
15
19
|
) {}
|
|
16
20
|
|
|
17
21
|
async getEntityById(id: number): Promise<EntityMaster | null> {
|
|
@@ -26,6 +30,32 @@ export class EntityMasterRepository {
|
|
|
26
30
|
return data;
|
|
27
31
|
}
|
|
28
32
|
|
|
33
|
+
async getAllEntityDropdownData(entity_type:string,loggedInUser) : Promise<{ label: string; value: any }[]> {
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
let relations = await this.entityRelationRepo
|
|
38
|
+
.createQueryBuilder('rel')
|
|
39
|
+
.select([
|
|
40
|
+
'rel.name AS label',
|
|
41
|
+
'rel.target_entity_type AS value',
|
|
42
|
+
])
|
|
43
|
+
.where('rel.source_entity_type = :entityType', { entityType: entity_type })
|
|
44
|
+
.andWhere('rel.organization_id = :orgId', { orgId: loggedInUser.organization_id })
|
|
45
|
+
.getRawMany();
|
|
46
|
+
|
|
47
|
+
// console.log(relations,"-------------")
|
|
48
|
+
let parentEntityLabelName = await this.entityMasterRepository.findOne({where:{organization_id: loggedInUser.organization_id,mapped_entity_type:entity_type}});
|
|
49
|
+
let dropdownData :any[]=[...relations];
|
|
50
|
+
if(parentEntityLabelName) {
|
|
51
|
+
dropdownData.push({label:parentEntityLabelName.name,value:entity_type
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return dropdownData.length ? dropdownData:[];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
29
59
|
async getEntityByMappedEntityType(
|
|
30
60
|
mappedEntityType: string,
|
|
31
61
|
organizationId: number,
|
|
@@ -96,6 +96,10 @@ export class AttributeMasterService {
|
|
|
96
96
|
return this.attributeMasterRepository.getAttributeById(id);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
async getAttributesByEntityType(entity_type,loggedInUser){
|
|
100
|
+
return this.attributeMasterRepository.getAllAttributeByEntity(entity_type,loggedInUser)
|
|
101
|
+
}
|
|
102
|
+
|
|
99
103
|
async getAttributesByMappedEntityType(
|
|
100
104
|
entityType: string,
|
|
101
105
|
loggedInUser: UserData,
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Injectable } from "@nestjs/common";
|
|
2
|
+
import { EntityServiceImpl } from "./entity-service-impl.service";
|
|
3
|
+
import { EntityUpdateRepository } from "../repository/entity-attribute-update.repository";
|
|
4
|
+
|
|
5
|
+
@Injectable()
|
|
6
|
+
export class EntityUpdateService extends EntityServiceImpl{
|
|
7
|
+
|
|
8
|
+
constructor(
|
|
9
|
+
private readonly entityUpdateRepository:EntityUpdateRepository
|
|
10
|
+
){
|
|
11
|
+
super();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async execute(payload: any): Promise<any> {
|
|
15
|
+
|
|
16
|
+
let { entity, user, config } = payload;
|
|
17
|
+
console.log(entity)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
if (entity.entity_type !== 'LEAD') {
|
|
21
|
+
entity = await this.getEntityData('LEAD', entity.parent_id,user );
|
|
22
|
+
}
|
|
23
|
+
// console.log(entity,"---------------------------------------");
|
|
24
|
+
|
|
25
|
+
return this.entityUpdateRepository.updateEntityAttribute(entity,config);
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -23,6 +23,10 @@ export class EntityMasterService {
|
|
|
23
23
|
return this.entityMasterRepo.getEntityById(id);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
async getAllEntityDropDown(entity_type:string,loggedInUser): Promise<{ label: string; value: any }[]>{
|
|
27
|
+
return this.entityMasterRepo.getAllEntityDropdownData(entity_type,loggedInUser);
|
|
28
|
+
}
|
|
29
|
+
|
|
26
30
|
async getEntityData(
|
|
27
31
|
mappedEntityType: string | null,
|
|
28
32
|
loggedInUser,
|
|
@@ -166,4 +170,6 @@ export class EntityMasterService {
|
|
|
166
170
|
loggedInUser,
|
|
167
171
|
);
|
|
168
172
|
}
|
|
173
|
+
|
|
174
|
+
|
|
169
175
|
}
|
|
@@ -95,8 +95,8 @@ export class ResolverService {
|
|
|
95
95
|
if (dateValue.isValid()) {
|
|
96
96
|
resolvedEntityData[field] =
|
|
97
97
|
attr.element_type === 'date'
|
|
98
|
-
? dateValue.format('DD-
|
|
99
|
-
: dateValue.format('DD-
|
|
98
|
+
? dateValue.format('DD-MMM-YYYY')
|
|
99
|
+
: dateValue.format('DD-MMM-YYYY HH:mm:ss');
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
|
|
@@ -149,15 +149,6 @@ export class ModuleAccessService {
|
|
|
149
149
|
level_id: number;
|
|
150
150
|
organization_id: number;
|
|
151
151
|
}) {
|
|
152
|
-
console.log(
|
|
153
|
-
'step 1',
|
|
154
|
-
userId,
|
|
155
|
-
appcode,
|
|
156
|
-
level_type,
|
|
157
|
-
level_id,
|
|
158
|
-
organization_id,
|
|
159
|
-
);
|
|
160
|
-
|
|
161
152
|
// Step 1: Resolve roles
|
|
162
153
|
const roleCodes = await this.menuRepository.resolveUserRoles(
|
|
163
154
|
userId,
|
|
@@ -166,21 +157,18 @@ export class ModuleAccessService {
|
|
|
166
157
|
level_id,
|
|
167
158
|
);
|
|
168
159
|
|
|
169
|
-
console.log(roleCodes, 'roleCodes');
|
|
170
|
-
|
|
171
160
|
if (!roleCodes || roleCodes.length === 0) {
|
|
172
161
|
return [];
|
|
173
162
|
}
|
|
174
163
|
|
|
175
164
|
const roleIds = roleCodes.map(Number);
|
|
176
|
-
|
|
165
|
+
|
|
177
166
|
// Step 2: Get full permissions
|
|
178
167
|
const allPermissions =
|
|
179
168
|
await this.moduleAccessRepository.getModuleAccessByRoles(
|
|
180
169
|
roleIds,
|
|
181
170
|
appcode,
|
|
182
171
|
);
|
|
183
|
-
console.log('step 2', allPermissions);
|
|
184
172
|
|
|
185
173
|
// Step 3: If level_type is SCH, check school status using raw query
|
|
186
174
|
if (level_type === 'SCH') {
|
|
@@ -188,19 +176,18 @@ export class ModuleAccessService {
|
|
|
188
176
|
`SELECT * FROM sso_school WHERE id = ${level_id}`);
|
|
189
177
|
|
|
190
178
|
const school = result?.[0];
|
|
191
|
-
console.log('step 3', school);
|
|
192
179
|
|
|
193
180
|
const resolveStatus = await this.listMasterService.getResolvedListCode(
|
|
194
181
|
STATUS_INACTIVE,
|
|
195
182
|
organization_id || 0,
|
|
196
183
|
);
|
|
197
184
|
|
|
198
|
-
if (!school || school.status
|
|
185
|
+
if (!school || school.status === resolveStatus.id || 'INACTIVE') {
|
|
199
186
|
// Return only VIEW permissions
|
|
200
187
|
return allPermissions.filter((perm) => perm.action === 'VIEW');
|
|
201
188
|
}
|
|
202
189
|
}
|
|
203
|
-
|
|
190
|
+
|
|
204
191
|
// Step 4: Return all permissions normally
|
|
205
192
|
return allPermissions;
|
|
206
193
|
}
|
|
@@ -2,12 +2,14 @@ import { BadRequestException, Injectable } from '@nestjs/common';
|
|
|
2
2
|
import { InjectRepository } from '@nestjs/typeorm';
|
|
3
3
|
import { TaskDataEntity } from '../entity/task-data.entity';
|
|
4
4
|
import { DataSource, Repository } from 'typeorm';
|
|
5
|
+
import { EntityDynamicService } from 'src/module/meta/service/entity-dynamic.service';
|
|
5
6
|
|
|
6
7
|
@Injectable()
|
|
7
8
|
export class TaskRepository {
|
|
8
9
|
constructor(
|
|
9
10
|
@InjectRepository(TaskDataEntity)
|
|
10
11
|
private readonly TaskRepository: Repository<TaskDataEntity>,
|
|
12
|
+
private readonly entityDynamicService: EntityDynamicService,
|
|
11
13
|
private readonly dataSource: DataSource,
|
|
12
14
|
) {}
|
|
13
15
|
|
|
@@ -70,6 +72,11 @@ export class TaskRepository {
|
|
|
70
72
|
|
|
71
73
|
console.log({ due_date, due_time });
|
|
72
74
|
|
|
75
|
+
const taskCode = await this.entityDynamicService.getCode(
|
|
76
|
+
'TASK',
|
|
77
|
+
loggedInUser,
|
|
78
|
+
);
|
|
79
|
+
|
|
73
80
|
const taskData = this.TaskRepository.create({
|
|
74
81
|
stage_id: act.stage_id,
|
|
75
82
|
user_id: loggedInUser.id,
|
|
@@ -88,6 +95,7 @@ export class TaskRepository {
|
|
|
88
95
|
status: todoListMasterItemId[0]?.id,
|
|
89
96
|
category: act?.action_category_code,
|
|
90
97
|
task_owner: leadData[0]?.lead_owner,
|
|
98
|
+
code: taskCode,
|
|
91
99
|
});
|
|
92
100
|
await this.TaskRepository.save(taskData);
|
|
93
101
|
}
|
|
@@ -11,6 +11,7 @@ import { ActionHandler } from 'src/module/workflow-automation/interface/action.d
|
|
|
11
11
|
import * as moment from 'moment';
|
|
12
12
|
import { ConfigService } from '@nestjs/config';
|
|
13
13
|
import axios from 'axios';
|
|
14
|
+
import { ChecksumAlgorithm } from '@aws-sdk/client-s3';
|
|
14
15
|
|
|
15
16
|
@Injectable()
|
|
16
17
|
@ActionHandler('add_task')
|
|
@@ -29,41 +30,27 @@ export class TaskService extends EntityServiceImpl {
|
|
|
29
30
|
name: string = 'add_task';
|
|
30
31
|
|
|
31
32
|
async execute(payload: any): Promise<any> {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
let toValue: string | null = null;
|
|
35
|
-
|
|
36
|
-
// 2. Get current stage_id from frm_wf_stage_movement_data
|
|
37
|
-
const stageRow = await this.dataSource.query(
|
|
38
|
-
`SELECT stage_id
|
|
39
|
-
FROM frm_wf_stage_movement_data
|
|
40
|
-
WHERE mapped_entity_id = $1
|
|
41
|
-
AND is_current = 'Y'
|
|
42
|
-
LIMIT 1`,
|
|
43
|
-
[entity.id],
|
|
44
|
-
);
|
|
33
|
+
let { entity, user, config } = payload;
|
|
45
34
|
|
|
46
|
-
const
|
|
35
|
+
const { organization_id, level_id, level_type } = entity;
|
|
47
36
|
|
|
48
|
-
if (
|
|
49
|
-
|
|
50
|
-
`No current stage found in frm_wf_stage_movement_data for entity_id=${entity.id}`,
|
|
51
|
-
);
|
|
37
|
+
if (entity.entity_type !== 'LEAD') {
|
|
38
|
+
entity = await this.getEntityData('LEAD', entity.parent_id, user);
|
|
52
39
|
}
|
|
53
40
|
|
|
54
41
|
// 3. Build entityData
|
|
55
42
|
const entityData = {
|
|
56
|
-
...config,
|
|
57
43
|
mapped_entity_id: entity.id,
|
|
58
44
|
mapped_entity_type: entity.entity_type,
|
|
59
|
-
task_owner:
|
|
60
|
-
stage_id: stageId,
|
|
45
|
+
task_owner: entity.lead_owner,
|
|
46
|
+
stage_id: entity.stageId,
|
|
61
47
|
status: config.status,
|
|
62
|
-
due_date:
|
|
63
|
-
due_time:
|
|
64
|
-
reminder: config.reminder,
|
|
48
|
+
due_date: Date.now() + 2,
|
|
49
|
+
due_time: Date.now(),
|
|
65
50
|
description: config.description,
|
|
66
51
|
is_mandatory: config.is_mandatory,
|
|
52
|
+
name: config.name,
|
|
53
|
+
entity_type: 'TASK',
|
|
67
54
|
};
|
|
68
55
|
|
|
69
56
|
return await this.createEntity(entityData, user);
|
|
@@ -161,6 +148,29 @@ export class TaskService extends EntityServiceImpl {
|
|
|
161
148
|
loggedInUser.organization_id,
|
|
162
149
|
]);
|
|
163
150
|
|
|
151
|
+
const oldStatusQuery = `
|
|
152
|
+
SELECT *
|
|
153
|
+
FROM frm_wf_task_data
|
|
154
|
+
WHERE id = $1
|
|
155
|
+
AND organization_id = $2
|
|
156
|
+
LIMIT 1;
|
|
157
|
+
`;
|
|
158
|
+
|
|
159
|
+
const [oldRow] = await this.dataSource.query(oldStatusQuery, [
|
|
160
|
+
entityData.id,
|
|
161
|
+
loggedInUser.organization_id,
|
|
162
|
+
]);
|
|
163
|
+
|
|
164
|
+
const oldStatusRows = await this.dataSource.query(taskStatusQuery, [
|
|
165
|
+
oldRow.status,
|
|
166
|
+
loggedInUser.organization_id,
|
|
167
|
+
]);
|
|
168
|
+
|
|
169
|
+
const isStatusChanged =
|
|
170
|
+
statusRows.length > 0 &&
|
|
171
|
+
oldStatusRows.length > 0 &&
|
|
172
|
+
statusRows[0].name !== oldStatusRows[0].name;
|
|
173
|
+
|
|
164
174
|
const isCompletedStatus =
|
|
165
175
|
statusRows.length > 0 &&
|
|
166
176
|
statusRows[0].name?.toLowerCase() === 'completed';
|
|
@@ -190,20 +200,7 @@ export class TaskService extends EntityServiceImpl {
|
|
|
190
200
|
}
|
|
191
201
|
|
|
192
202
|
try {
|
|
193
|
-
|
|
194
|
-
const editLogData = {
|
|
195
|
-
mapped_entity_id: updatedEntity.mapped_entity_id,
|
|
196
|
-
mapped_entity_type: updatedEntity.mapped_entity_type,
|
|
197
|
-
title: `Task edited`,
|
|
198
|
-
description: `${updatedEntity.code} was edited`,
|
|
199
|
-
category: ACTIVITY_CATEGORIES.TASK,
|
|
200
|
-
action: 'edit',
|
|
201
|
-
appcode: loggedInUser.appcode,
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
await this.activityLogService.logActivity(editLogData, loggedInUser);
|
|
205
|
-
|
|
206
|
-
if (isCompletedStatus) {
|
|
203
|
+
if (isCompletedStatus && isStatusChanged) {
|
|
207
204
|
const completedLogData = {
|
|
208
205
|
mapped_entity_id: updatedEntity.mapped_entity_id,
|
|
209
206
|
mapped_entity_type: updatedEntity.mapped_entity_type,
|
|
@@ -218,6 +215,18 @@ export class TaskService extends EntityServiceImpl {
|
|
|
218
215
|
completedLogData,
|
|
219
216
|
loggedInUser,
|
|
220
217
|
);
|
|
218
|
+
} else {
|
|
219
|
+
const editLogData = {
|
|
220
|
+
mapped_entity_id: updatedEntity.mapped_entity_id,
|
|
221
|
+
mapped_entity_type: updatedEntity.mapped_entity_type,
|
|
222
|
+
title: `Task edited`,
|
|
223
|
+
description: `${updatedEntity.code} was edited`,
|
|
224
|
+
category: ACTIVITY_CATEGORIES.TASK,
|
|
225
|
+
action: 'edit',
|
|
226
|
+
appcode: loggedInUser.appcode,
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
await this.activityLogService.logActivity(editLogData, loggedInUser);
|
|
221
230
|
}
|
|
222
231
|
} catch (error) {
|
|
223
232
|
console.error(
|
|
@@ -273,7 +273,7 @@ export class WorkflowMetaService extends EntityServiceImpl {
|
|
|
273
273
|
is_current: 'Y',
|
|
274
274
|
});
|
|
275
275
|
|
|
276
|
-
this.populateActionService(
|
|
276
|
+
await this.populateActionService(
|
|
277
277
|
stageData.nextStage.id,
|
|
278
278
|
loggedInUser,
|
|
279
279
|
mapped_entity_id,
|
|
@@ -475,10 +475,24 @@ export class WorkflowMetaService extends EntityServiceImpl {
|
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
477
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
478
|
+
let leadOwnerName;
|
|
479
|
+
|
|
480
|
+
try {
|
|
481
|
+
const baseUrl = this.configService.get<string>('REDIRECT_BE_URL');
|
|
482
|
+
|
|
483
|
+
// Prepare query params
|
|
484
|
+
const queryParams = new URLSearchParams({
|
|
485
|
+
loggedInUser: JSON.stringify(loggedInUser),
|
|
486
|
+
}).toString();
|
|
487
|
+
|
|
488
|
+
const url = `${baseUrl}/entity/public/getById/${entityData?.lead_owner}?entity_type=USR&${queryParams}`;
|
|
489
|
+
|
|
490
|
+
const response = await axios.get(url);
|
|
491
|
+
|
|
492
|
+
leadOwnerName = response.data;
|
|
493
|
+
} catch (error) {
|
|
494
|
+
console.error('Internal Entity API call failed:', error.message);
|
|
495
|
+
}
|
|
482
496
|
|
|
483
497
|
try {
|
|
484
498
|
const logData = {
|
|
@@ -486,8 +500,8 @@ export class WorkflowMetaService extends EntityServiceImpl {
|
|
|
486
500
|
mapped_entity_type: 'LEAD',
|
|
487
501
|
title: 'Owner Assigned',
|
|
488
502
|
description: leadData?.lead_owner
|
|
489
|
-
? `${leadOwnerName
|
|
490
|
-
: `${leadOwnerName
|
|
503
|
+
? `${leadOwnerName?.name} reassigned as Lead owner.`
|
|
504
|
+
: `${leadOwnerName?.name} assigned as Lead owner.`,
|
|
491
505
|
action: 'assign',
|
|
492
506
|
category: ACTIVITY_CATEGORIES.ASSIGN,
|
|
493
507
|
appcode: loggedInUser.appcode,
|
|
@@ -584,25 +598,37 @@ export class WorkflowMetaService extends EntityServiceImpl {
|
|
|
584
598
|
const nextIdx = (lastIdx + 1) % userIds.length;
|
|
585
599
|
const nextUser = userIds[nextIdx];
|
|
586
600
|
|
|
587
|
-
//4) Update lead owner in the lead table
|
|
588
|
-
await this.dataSource.query(
|
|
589
|
-
|
|
590
|
-
UPDATE crm_lead
|
|
591
|
-
SET lead_owner =
|
|
592
|
-
WHERE organization_id =
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
ORDER BY created_date ASC
|
|
597
|
-
LIMIT 1
|
|
598
|
-
`,
|
|
599
|
-
|
|
600
|
-
);
|
|
601
|
+
//4) Update lead owner in the lead table no need because we are updating lead owner in updateLeadOwner method
|
|
602
|
+
// await this.dataSource.query(
|
|
603
|
+
// `
|
|
604
|
+
// UPDATE crm_lead
|
|
605
|
+
// SET lead_owner = ?
|
|
606
|
+
// WHERE organization_id = ?
|
|
607
|
+
// AND level_id = ?
|
|
608
|
+
// AND level_type = ?
|
|
609
|
+
// AND lead_owner IS NULL
|
|
610
|
+
// ORDER BY created_date ASC
|
|
611
|
+
// LIMIT 1
|
|
612
|
+
// `,
|
|
613
|
+
// [nextUser, organization_id, Number(level_id), level_type],
|
|
614
|
+
// );
|
|
601
615
|
|
|
602
616
|
console.log(`Assigning lead to user ID: ${nextUser}`);
|
|
603
617
|
|
|
604
618
|
const firstAction = actions[0];
|
|
605
619
|
|
|
620
|
+
// update lead owner status
|
|
621
|
+
await this.updateLeadOwner(
|
|
622
|
+
{
|
|
623
|
+
lead_id: mapped_entity_id,
|
|
624
|
+
lead_owner: nextUser,
|
|
625
|
+
stage_id: stage_id,
|
|
626
|
+
entity_type: mapped_entity_type,
|
|
627
|
+
action_id: firstAction.id,
|
|
628
|
+
},
|
|
629
|
+
loggedInUser,
|
|
630
|
+
);
|
|
631
|
+
|
|
606
632
|
// move task
|
|
607
633
|
await this.taskService.moveTask(loggedInUser, {
|
|
608
634
|
mapped_entity_type,
|
|
@@ -623,18 +649,6 @@ export class WorkflowMetaService extends EntityServiceImpl {
|
|
|
623
649
|
);
|
|
624
650
|
}
|
|
625
651
|
|
|
626
|
-
// update lead owner status
|
|
627
|
-
await this.updateLeadOwner(
|
|
628
|
-
{
|
|
629
|
-
lead_id: mapped_entity_id,
|
|
630
|
-
lead_owner: nextUser,
|
|
631
|
-
stage_id: stage_id,
|
|
632
|
-
entity_type: mapped_entity_type,
|
|
633
|
-
action_id: firstAction.id,
|
|
634
|
-
},
|
|
635
|
-
loggedInUser,
|
|
636
|
-
);
|
|
637
|
-
|
|
638
652
|
return nextUser;
|
|
639
653
|
}
|
|
640
654
|
}
|