rez_core 2.1.110 → 2.1.112
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 +2 -0
- package/dist/app.module.js.map +1 -1
- package/dist/constant/global.constant.d.ts +2 -0
- package/dist/constant/global.constant.js +3 -1
- package/dist/constant/global.constant.js.map +1 -1
- package/dist/core.module.js +3 -0
- package/dist/core.module.js.map +1 -1
- package/dist/module/listmaster/controller/list-master.controller.d.ts +0 -3
- package/dist/module/listmaster/controller/list-master.controller.js +0 -16
- package/dist/module/listmaster/controller/list-master.controller.js.map +1 -1
- package/dist/module/listmaster/service/list-master-item.service.d.ts +1 -2
- package/dist/module/listmaster/service/list-master-item.service.js +0 -41
- package/dist/module/listmaster/service/list-master-item.service.js.map +1 -1
- package/dist/module/master/service/master.service.js +1 -1
- package/dist/module/master/service/master.service.js.map +1 -1
- package/dist/module/meta/service/entity-service-impl.service.d.ts +2 -0
- package/dist/module/meta/service/entity-service-impl.service.js.map +1 -1
- package/dist/module/resolver/controller/resolver.controller.d.ts +8 -0
- package/dist/module/resolver/controller/resolver.controller.js +45 -0
- package/dist/module/resolver/controller/resolver.controller.js.map +1 -0
- package/dist/module/resolver/resolver.module.d.ts +2 -0
- package/dist/module/resolver/resolver.module.js +25 -0
- package/dist/module/resolver/resolver.module.js.map +1 -0
- package/dist/module/resolver/service/resolver.service.d.ts +8 -0
- package/dist/module/resolver/service/resolver.service.js +68 -0
- package/dist/module/resolver/service/resolver.service.js.map +1 -0
- package/dist/module/workflow/controller/workflow-list-master.controller.d.ts +11 -0
- package/dist/module/workflow/controller/workflow-list-master.controller.js +52 -0
- package/dist/module/workflow/controller/workflow-list-master.controller.js.map +1 -0
- package/dist/module/workflow/entity/action-category.entity.d.ts +2 -0
- package/dist/module/workflow/entity/action-category.entity.js +8 -0
- package/dist/module/workflow/entity/action-category.entity.js.map +1 -1
- package/dist/module/workflow/entity/action-template-mapping.entity.d.ts +1 -1
- package/dist/module/workflow/entity/action-template-mapping.entity.js +3 -3
- package/dist/module/workflow/entity/action-template-mapping.entity.js.map +1 -1
- package/dist/module/workflow/entity/stage-movement-data.entity.d.ts +9 -0
- package/dist/module/workflow/entity/stage-movement-data.entity.js +47 -0
- package/dist/module/workflow/entity/stage-movement-data.entity.js.map +1 -0
- package/dist/module/workflow/entity/stage.entity.d.ts +1 -0
- package/dist/module/workflow/entity/stage.entity.js +4 -0
- package/dist/module/workflow/entity/stage.entity.js.map +1 -1
- package/dist/module/workflow/entity/workflow-data.entity.d.ts +4 -0
- package/dist/module/workflow/entity/workflow-data.entity.js +27 -0
- package/dist/module/workflow/entity/workflow-data.entity.js.map +1 -0
- package/dist/module/workflow/service/action.service.d.ts +3 -2
- package/dist/module/workflow/service/action.service.js +19 -9
- package/dist/module/workflow/service/action.service.js.map +1 -1
- package/dist/module/workflow/service/stage.service.d.ts +6 -0
- package/dist/module/workflow/service/stage.service.js +25 -1
- package/dist/module/workflow/service/stage.service.js.map +1 -1
- package/dist/module/workflow/service/workflow-list-master.service.d.ts +8 -0
- package/dist/module/workflow/service/workflow-list-master.service.js +51 -0
- package/dist/module/workflow/service/workflow-list-master.service.js.map +1 -0
- package/dist/module/workflow/service/workflow.service.js.map +1 -1
- package/dist/module/workflow/workflow.module.js +4 -1
- package/dist/module/workflow/workflow.module.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/app.module.ts +2 -0
- package/src/constant/global.constant.ts +2 -0
- package/src/core.module.ts +3 -0
- package/src/module/listmaster/controller/list-master.controller.ts +16 -16
- package/src/module/listmaster/service/list-master-item.service.ts +62 -63
- package/src/module/master/service/master.service.ts +1 -1
- package/src/module/meta/service/entity-service-impl.service.ts +3 -2
- package/src/module/resolver/controller/resolver.controller.ts +35 -0
- package/src/module/resolver/resolver.module.ts +12 -0
- package/src/module/resolver/service/resolver.service.ts +84 -0
- package/src/module/workflow/controller/workflow-list-master.controller.ts +25 -0
- package/src/module/workflow/entity/action-category.entity.ts +7 -1
- package/src/module/workflow/entity/action-template-mapping.entity.ts +2 -2
- package/src/module/workflow/entity/stage-movement-data.entity.ts +26 -0
- package/src/module/workflow/entity/stage.entity.ts +3 -0
- package/src/module/workflow/entity/workflow-data.entity.ts +11 -0
- package/src/module/workflow/service/action.service.ts +61 -32
- package/src/module/workflow/service/stage.service.ts +43 -1
- package/src/module/workflow/service/workflow-list-master.service.ts +44 -0
- package/src/module/workflow/service/workflow.service.ts +3 -3
- package/src/module/workflow/workflow.module.ts +4 -1
package/package.json
CHANGED
package/src/app.module.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { FilterModule } from './module/filter/filter.module';
|
|
|
14
14
|
import { LeadModule } from './module/lead/lead.module';
|
|
15
15
|
import { LayoutPreferenceModule } from './module/layout_preference/layout_preference.module';
|
|
16
16
|
import { WorkflowModule } from './module/workflow/workflow.module';
|
|
17
|
+
import { ResolverModule } from './module/resolver/resolver.module';
|
|
17
18
|
|
|
18
19
|
@Module({
|
|
19
20
|
imports: [
|
|
@@ -32,6 +33,7 @@ import { WorkflowModule } from './module/workflow/workflow.module';
|
|
|
32
33
|
LeadModule,
|
|
33
34
|
LayoutPreferenceModule,
|
|
34
35
|
WorkflowModule,
|
|
36
|
+
ResolverModule,
|
|
35
37
|
],
|
|
36
38
|
})
|
|
37
39
|
export class AppModule {}
|
package/src/core.module.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { FilterModule } from './module/filter/filter.module';
|
|
|
13
13
|
import { AuthModule } from './module/auth/auth.module';
|
|
14
14
|
import { LeadModule } from './module/lead/lead.module';
|
|
15
15
|
import { LayoutPreferenceModule } from './module/layout_preference/layout_preference.module';
|
|
16
|
+
import { ResolverModule } from './module/resolver/resolver.module';
|
|
16
17
|
|
|
17
18
|
@Global()
|
|
18
19
|
@Module({})
|
|
@@ -33,6 +34,7 @@ export class CoreModule {
|
|
|
33
34
|
AuthModule,
|
|
34
35
|
LeadModule,
|
|
35
36
|
LayoutPreferenceModule,
|
|
37
|
+
ResolverModule,
|
|
36
38
|
];
|
|
37
39
|
|
|
38
40
|
const exportsArray = [
|
|
@@ -46,6 +48,7 @@ export class CoreModule {
|
|
|
46
48
|
FilterModule,
|
|
47
49
|
LeadModule,
|
|
48
50
|
LayoutPreferenceModule,
|
|
51
|
+
ResolverModule,
|
|
49
52
|
];
|
|
50
53
|
|
|
51
54
|
if (isSso) {
|
|
@@ -50,23 +50,23 @@ export class ListMasterController {
|
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
@Post('/getResolvedListMasterItems/:type')
|
|
54
|
-
@UseGuards(JwtAuthGuard)
|
|
55
|
-
@HttpCode(HttpStatus.OK)
|
|
56
|
-
async getResolvedListMasterItems(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
) {
|
|
61
|
-
|
|
62
|
-
|
|
53
|
+
// @Post('/getResolvedListMasterItems/:type')
|
|
54
|
+
// @UseGuards(JwtAuthGuard)
|
|
55
|
+
// @HttpCode(HttpStatus.OK)
|
|
56
|
+
// async getResolvedListMasterItems(
|
|
57
|
+
// @Body() entityData: any,
|
|
58
|
+
// @Param('type') type: string,
|
|
59
|
+
// @Req() req: Request & { user: any },
|
|
60
|
+
// ) {
|
|
61
|
+
// const loggedInUser = req.user.userData;
|
|
62
|
+
// const entityType = type;
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
64
|
+
// return await this.listMasterItemService.getResolvedListMasterItems(
|
|
65
|
+
// loggedInUser,
|
|
66
|
+
// entityData,
|
|
67
|
+
// entityType,
|
|
68
|
+
// );
|
|
69
|
+
// }
|
|
70
70
|
|
|
71
71
|
@Get('/getListMasterItems/:type')
|
|
72
72
|
@UseGuards(JwtAuthGuard)
|
|
@@ -18,7 +18,7 @@ export class ListMasterItemService extends EntityServiceImpl {
|
|
|
18
18
|
private readonly listMasterRepo: ListMasterItemsRepository,
|
|
19
19
|
@Inject(forwardRef(() => EntityServiceImpl))
|
|
20
20
|
private readonly entityServiceImpl: EntityServiceImpl,
|
|
21
|
-
|
|
21
|
+
protected readonly attributeMasterService: AttributeMasterService,
|
|
22
22
|
) {
|
|
23
23
|
super();
|
|
24
24
|
}
|
|
@@ -213,66 +213,65 @@ export class ListMasterItemService extends EntityServiceImpl {
|
|
|
213
213
|
// return resolvedEntityData;
|
|
214
214
|
// }
|
|
215
215
|
|
|
216
|
-
async getResolvedListMasterItems(
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
): Promise<any> {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
}
|
|
216
|
+
// async getResolvedListMasterItems(
|
|
217
|
+
// loggedInUser: UserData,
|
|
218
|
+
// entityData: any,
|
|
219
|
+
// entityType: string,
|
|
220
|
+
// ): Promise<any> {
|
|
221
|
+
// // const resolvedEntityData = super.getResolvedData(
|
|
222
|
+
// // loggedInUser,
|
|
223
|
+
// // entityData,
|
|
224
|
+
// // entityType,
|
|
225
|
+
// // );
|
|
226
|
+
// // const attributeItems =
|
|
227
|
+
// // await this.attributeMasterService.findAttributesByMappedEntityType(
|
|
228
|
+
// // entityType,
|
|
229
|
+
// // loggedInUser,
|
|
230
|
+
// // );
|
|
231
|
+
// // const resolvedEntityData = { ...entityData };
|
|
232
|
+
// // for (const attr of attributeItems) {
|
|
233
|
+
// // const field = attr.attribute_key;
|
|
234
|
+
// // const codeValue = entityData[field];
|
|
235
|
+
// // if (!codeValue) continue;
|
|
236
|
+
// // // ---------- ENTITY data_source_type ----------
|
|
237
|
+
// // if (attr.data_source_type === 'entity') {
|
|
238
|
+
// // if (Array.isArray(codeValue)) {
|
|
239
|
+
// // const resolvedValues: string[] = [];
|
|
240
|
+
// // for (const code of codeValue) {
|
|
241
|
+
// // const item = await super.getEntityData(
|
|
242
|
+
// // attr.datasource_list,
|
|
243
|
+
// // code,
|
|
244
|
+
// // loggedInUser,
|
|
245
|
+
// // );
|
|
246
|
+
// // resolvedValues.push(item?.[attr.data_source_attribute] ?? code);
|
|
247
|
+
// // }
|
|
248
|
+
// // resolvedEntityData[field] = resolvedValues;
|
|
249
|
+
// // } else {
|
|
250
|
+
// // const item = await super.getEntityData(
|
|
251
|
+
// // attr.datasource_list,
|
|
252
|
+
// // codeValue,
|
|
253
|
+
// // loggedInUser,
|
|
254
|
+
// // );
|
|
255
|
+
// // resolvedEntityData[field] =
|
|
256
|
+
// // item?.[attr.data_source_attribute] ?? codeValue;
|
|
257
|
+
// // }
|
|
258
|
+
// // }
|
|
259
|
+
// // // ---------- MASTER data_source_type ----------
|
|
260
|
+
// // else if (attr.data_source_type === 'master') {
|
|
261
|
+
// // if (Array.isArray(codeValue)) {
|
|
262
|
+
// // const resolvedValues: string[] = [];
|
|
263
|
+
// // for (const code of codeValue) {
|
|
264
|
+
// // const item = await this.listItemsRepo.findById(code);
|
|
265
|
+
// // resolvedValues.push(item?.[attr.data_source_attribute] ?? code);
|
|
266
|
+
// // }
|
|
267
|
+
// // resolvedEntityData[field] = resolvedValues;
|
|
268
|
+
// // } else {
|
|
269
|
+
// // const item = await this.listItemsRepo.findById(codeValue);
|
|
270
|
+
// // resolvedEntityData[field] =
|
|
271
|
+
// // item?.[attr.data_source_attribute] ?? codeValue;
|
|
272
|
+
// // }
|
|
273
|
+
// // }
|
|
274
|
+
// // }
|
|
275
|
+
// // return resolvedEntityData;
|
|
276
|
+
// }
|
|
278
277
|
}
|
|
@@ -167,7 +167,7 @@ export class MasterService {
|
|
|
167
167
|
|
|
168
168
|
const attributes =
|
|
169
169
|
await this.attributeMasterService.findAttributesByMappedEntityType(
|
|
170
|
-
entityMasterData
|
|
170
|
+
entityMasterData?.mapped_entity_type,
|
|
171
171
|
loggedInUser.organization_id,
|
|
172
172
|
);
|
|
173
173
|
|
|
@@ -21,6 +21,8 @@ import {
|
|
|
21
21
|
} from '../../../constant/global.constant';
|
|
22
22
|
import { EntityValidationService } from './entity-validation.service';
|
|
23
23
|
import { ListMasterService } from 'src/module/listmaster/service/list-master.service';
|
|
24
|
+
import { ListMasterItemService } from 'src/module/listmaster/service/list-master-item.service';
|
|
25
|
+
import { AttributeMasterService } from './attribute-master.service';
|
|
24
26
|
|
|
25
27
|
@Injectable()
|
|
26
28
|
export class EntityServiceImpl implements EntityService<BaseEntity> {
|
|
@@ -33,8 +35,7 @@ export class EntityServiceImpl implements EntityService<BaseEntity> {
|
|
|
33
35
|
@Inject() protected readonly loggingService: LoggingService;
|
|
34
36
|
@Inject()
|
|
35
37
|
protected readonly entityValidationService: EntityValidationService;
|
|
36
|
-
|
|
37
|
-
// private readonly listMasterService: ListMasterService;
|
|
38
|
+
protected readonly attributeMasterService: AttributeMasterService;
|
|
38
39
|
|
|
39
40
|
async createEntity(
|
|
40
41
|
entityData: BaseEntity,
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Body,
|
|
3
|
+
Controller,
|
|
4
|
+
HttpCode,
|
|
5
|
+
HttpStatus,
|
|
6
|
+
Param,
|
|
7
|
+
Post,
|
|
8
|
+
Req,
|
|
9
|
+
UseGuards,
|
|
10
|
+
} from '@nestjs/common';
|
|
11
|
+
import { ResolverService } from '../service/resolver.service';
|
|
12
|
+
import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard';
|
|
13
|
+
|
|
14
|
+
@Controller()
|
|
15
|
+
export class ResolverController {
|
|
16
|
+
constructor(private readonly resolverService: ResolverService) {}
|
|
17
|
+
|
|
18
|
+
@Post('getResolvedData/:type')
|
|
19
|
+
@UseGuards(JwtAuthGuard)
|
|
20
|
+
@HttpCode(HttpStatus.OK)
|
|
21
|
+
async getResolvedListMasterItems(
|
|
22
|
+
@Body() entityData: any,
|
|
23
|
+
@Param('type') type: string,
|
|
24
|
+
@Req() req: Request & { user: any },
|
|
25
|
+
) {
|
|
26
|
+
const loggedInUser = req.user.userData;
|
|
27
|
+
const entityType = type;
|
|
28
|
+
|
|
29
|
+
return await this.resolverService.getResolvedData(
|
|
30
|
+
loggedInUser,
|
|
31
|
+
entityData,
|
|
32
|
+
entityType,
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Module } from '@nestjs/common';
|
|
2
|
+
import { ResolverService } from './service/resolver.service';
|
|
3
|
+
import { ResolverController } from './controller/resolver.controller';
|
|
4
|
+
import { EntityModule } from '../meta/entity.module';
|
|
5
|
+
|
|
6
|
+
@Module({
|
|
7
|
+
imports: [EntityModule],
|
|
8
|
+
controllers: [ResolverController],
|
|
9
|
+
providers: [ResolverService],
|
|
10
|
+
exports: [ResolverService],
|
|
11
|
+
})
|
|
12
|
+
export class ResolverModule {}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { DataSource } from 'typeorm';
|
|
2
|
+
import { Injectable } from '@nestjs/common';
|
|
3
|
+
import { UserData } from 'src/module/user/entity/user.entity';
|
|
4
|
+
import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
|
|
5
|
+
|
|
6
|
+
@Injectable()
|
|
7
|
+
export class ResolverService extends EntityServiceImpl {
|
|
8
|
+
constructor(private readonly dataSource: DataSource) {
|
|
9
|
+
super();
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async getResolvedData(
|
|
13
|
+
loggedInUser: UserData,
|
|
14
|
+
entityData: any,
|
|
15
|
+
entityType: string,
|
|
16
|
+
): Promise<any> {
|
|
17
|
+
const attributeItems = await this.dataSource.query(
|
|
18
|
+
`SELECT * FROM cr_attribute_master WHERE mapped_entity_type = ? AND organization_id = ?`,
|
|
19
|
+
[entityType, loggedInUser.organization_id],
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const resolvedEntityData = { ...entityData };
|
|
23
|
+
|
|
24
|
+
for (const attr of attributeItems) {
|
|
25
|
+
const field = attr.attribute_key;
|
|
26
|
+
const codeValue = entityData[field];
|
|
27
|
+
|
|
28
|
+
if (!codeValue) continue;
|
|
29
|
+
|
|
30
|
+
// -------- ENTITY data_source_type --------
|
|
31
|
+
if (attr.data_source_type === 'entity') {
|
|
32
|
+
if (Array.isArray(codeValue)) {
|
|
33
|
+
const resolvedValues: string[] = [];
|
|
34
|
+
|
|
35
|
+
for (const code of codeValue) {
|
|
36
|
+
const item = await super.getEntityData(
|
|
37
|
+
attr.datasource_list,
|
|
38
|
+
code,
|
|
39
|
+
loggedInUser,
|
|
40
|
+
);
|
|
41
|
+
resolvedValues.push(item?.[attr.data_source_attribute] ?? code);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
resolvedEntityData[field] = resolvedValues;
|
|
45
|
+
} else {
|
|
46
|
+
const item = await super.getEntityData(
|
|
47
|
+
attr.datasource_list,
|
|
48
|
+
codeValue,
|
|
49
|
+
loggedInUser,
|
|
50
|
+
);
|
|
51
|
+
resolvedEntityData[field] =
|
|
52
|
+
item?.[attr.data_source_attribute] ?? codeValue;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// -------- MASTER data_source_type --------
|
|
57
|
+
else if (attr.data_source_type === 'master') {
|
|
58
|
+
if (Array.isArray(codeValue)) {
|
|
59
|
+
const resolvedValues: string[] = [];
|
|
60
|
+
|
|
61
|
+
for (const code of codeValue) {
|
|
62
|
+
const [item] = await this.dataSource.query(
|
|
63
|
+
`SELECT * FROM cr_list_master_items WHERE id = ? AND organization_id = ?`,
|
|
64
|
+
[code, loggedInUser.organization_id],
|
|
65
|
+
);
|
|
66
|
+
resolvedValues.push(item?.[attr.data_source_attribute] ?? code);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
resolvedEntityData[field] = resolvedValues;
|
|
70
|
+
} else {
|
|
71
|
+
const [item] = await this.dataSource.query(
|
|
72
|
+
`SELECT * FROM cr_list_master_items WHERE id = ? AND organization_id = ?`,
|
|
73
|
+
[codeValue, loggedInUser.organization_id],
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
resolvedEntityData[field] =
|
|
77
|
+
item?.[attr.data_source_attribute] ?? codeValue;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return resolvedEntityData;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Controller, Post, Body, HttpCode, HttpStatus } from '@nestjs/common';
|
|
2
|
+
import { WorkflowListMasterService } from '../service/workflow-list-master.service';
|
|
3
|
+
|
|
4
|
+
@Controller('/workflow-list')
|
|
5
|
+
export class WorkflowListMasterController {
|
|
6
|
+
constructor(private readonly workflowService: WorkflowListMasterService) {}
|
|
7
|
+
|
|
8
|
+
@Post('/getActionsByStage')
|
|
9
|
+
@HttpCode(HttpStatus.OK)
|
|
10
|
+
async getActionsByStage(@Body() body: { stage_id: number }) {
|
|
11
|
+
const result = await this.workflowService.getActionCategoryListByStageId(
|
|
12
|
+
body.stage_id,
|
|
13
|
+
);
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@Post('/getStagesByGroup')
|
|
18
|
+
@HttpCode(HttpStatus.OK)
|
|
19
|
+
async getStagesByGroup(@Body() body: { stage_group_id: number }) {
|
|
20
|
+
const result = await this.workflowService.getStagesByGroup(
|
|
21
|
+
body.stage_group_id,
|
|
22
|
+
);
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ACTION_CATEGORY } from 'src/constant/global.constant';
|
|
2
2
|
import { BaseEntity } from 'src/module/meta/entity/base-entity.entity';
|
|
3
|
-
import { Entity } from 'typeorm';
|
|
3
|
+
import { Column, Entity } from 'typeorm';
|
|
4
4
|
|
|
5
5
|
@Entity({ name: 'cr_wf_action_category' })
|
|
6
6
|
export class ActionCategory extends BaseEntity {
|
|
@@ -8,4 +8,10 @@ export class ActionCategory extends BaseEntity {
|
|
|
8
8
|
super();
|
|
9
9
|
this.entity_type = ACTION_CATEGORY;
|
|
10
10
|
}
|
|
11
|
+
|
|
12
|
+
@Column({ type: 'varchar', nullable: true })
|
|
13
|
+
logo: string;
|
|
14
|
+
|
|
15
|
+
@Column({ type: 'varchar', nullable: true })
|
|
16
|
+
modalName: string;
|
|
11
17
|
}
|
|
@@ -12,6 +12,6 @@ export class ActionTemplateMapping extends BaseEntity {
|
|
|
12
12
|
@Column({ type: 'int', nullable: true })
|
|
13
13
|
stg_act_mapping_id: number;
|
|
14
14
|
|
|
15
|
-
@Column({ type: '
|
|
16
|
-
|
|
15
|
+
@Column({ type: 'varchar', nullable: true })
|
|
16
|
+
template_code: string;
|
|
17
17
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { STAGE_MOVEMENT_DATA } from 'src/constant/global.constant';
|
|
2
|
+
import { BaseEntity } from 'src/module/meta/entity/base-entity.entity';
|
|
3
|
+
import { Column, Entity } from 'typeorm';
|
|
4
|
+
|
|
5
|
+
@Entity({ name: 'cr_wf_stage_movement_data' })
|
|
6
|
+
export class StageMovementData extends BaseEntity {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.entity_type = STAGE_MOVEMENT_DATA;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@Column({ type: 'int', nullable: true })
|
|
13
|
+
current_user_id: number;
|
|
14
|
+
|
|
15
|
+
@Column({ type: 'int', nullable: true })
|
|
16
|
+
stage_action_mapping_id: number;
|
|
17
|
+
|
|
18
|
+
@Column({ type: 'date', nullable: true })
|
|
19
|
+
start_date: Date;
|
|
20
|
+
|
|
21
|
+
@Column({ type: 'date', nullable: true })
|
|
22
|
+
end_date: Date;
|
|
23
|
+
|
|
24
|
+
@Column({ type: 'varchar', nullable: true })
|
|
25
|
+
is_current: string;
|
|
26
|
+
}
|
|
@@ -12,6 +12,9 @@ export class Stage extends BaseEntity {
|
|
|
12
12
|
@Column({ type: 'int', nullable: true })
|
|
13
13
|
stage_group_id: number;
|
|
14
14
|
|
|
15
|
+
@Column({ type: 'varchar', length: 100, nullable: true })
|
|
16
|
+
full_name: string;
|
|
17
|
+
|
|
15
18
|
@Column({ type: 'int', nullable: true })
|
|
16
19
|
sortindex: number;
|
|
17
20
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { WORKFLOW_DATA } from 'src/constant/global.constant';
|
|
2
|
+
import { BaseEntity } from 'src/module/meta/entity/base-entity.entity';
|
|
3
|
+
import { Entity } from 'typeorm';
|
|
4
|
+
|
|
5
|
+
@Entity({ name: 'cr_workflow_data' })
|
|
6
|
+
export class WorkFlowData extends BaseEntity {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.entity_type = WORKFLOW_DATA;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -2,50 +2,79 @@ import { Injectable } from '@nestjs/common';
|
|
|
2
2
|
import { BaseEntity } from 'src/module/meta/entity/base-entity.entity';
|
|
3
3
|
import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
|
|
4
4
|
import { UserData } from 'src/module/user/entity/user.entity';
|
|
5
|
-
import { EntityManager } from 'typeorm';
|
|
5
|
+
import { DataSource, EntityManager } from 'typeorm';
|
|
6
6
|
|
|
7
7
|
@Injectable()
|
|
8
8
|
export class ActionService extends EntityServiceImpl {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
async createEntity(entityData: BaseEntity, loggedInUser: UserData | null, manager?: EntityManager | null, appcode?: string): Promise<any> {
|
|
14
|
-
console.log("entityData", entityData);
|
|
15
|
-
|
|
16
|
-
let actionData = entityData as any;
|
|
9
|
+
constructor(private readonly dataSource: DataSource) {
|
|
10
|
+
super();
|
|
11
|
+
}
|
|
17
12
|
|
|
18
|
-
|
|
13
|
+
async createEntity(
|
|
14
|
+
entityData: BaseEntity,
|
|
15
|
+
loggedInUser: UserData | null,
|
|
16
|
+
manager?: EntityManager | null,
|
|
17
|
+
appcode?: string,
|
|
18
|
+
): Promise<any> {
|
|
19
|
+
console.log('entityData', entityData);
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
action_id: action.id,
|
|
22
|
-
stage_id: actionData.stage_id,
|
|
23
|
-
entity_type:"STGM",
|
|
24
|
-
} as any;
|
|
21
|
+
let actionData = entityData as any;
|
|
25
22
|
|
|
26
|
-
|
|
23
|
+
let action = await super.createEntity(
|
|
24
|
+
entityData,
|
|
25
|
+
loggedInUser,
|
|
26
|
+
manager,
|
|
27
|
+
appcode,
|
|
28
|
+
);
|
|
27
29
|
|
|
28
|
-
|
|
30
|
+
let stageActionMapping = {
|
|
31
|
+
action_id: action.id,
|
|
32
|
+
stage_id: actionData.stage_id,
|
|
33
|
+
entity_type: 'STGM',
|
|
34
|
+
} as any;
|
|
29
35
|
|
|
30
|
-
|
|
36
|
+
let stageActionMappingData = await super.createEntity(
|
|
37
|
+
stageActionMapping,
|
|
38
|
+
loggedInUser,
|
|
39
|
+
manager,
|
|
40
|
+
appcode,
|
|
41
|
+
);
|
|
31
42
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
//templateData = getEntityData
|
|
43
|
+
if (Array.isArray(actionData.template) && actionData.template.length > 0) {
|
|
44
|
+
const templates = actionData.template;
|
|
35
45
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
template_code:"",
|
|
39
|
-
entity_type: "ACTM",
|
|
40
|
-
} as any;
|
|
41
|
-
|
|
42
|
-
//creaEntity
|
|
43
|
-
|
|
44
|
-
}
|
|
46
|
+
for (let i = 0; i < templates.length; i++) {
|
|
47
|
+
const templateId = templates[i];
|
|
45
48
|
|
|
49
|
+
// Fetch the template code from `cr_wf_comm_template`
|
|
50
|
+
const templateResult = await this.dataSource.query(
|
|
51
|
+
`SELECT code FROM cr_wf_comm_template WHERE id = ?`,
|
|
52
|
+
[templateId],
|
|
53
|
+
);
|
|
46
54
|
|
|
55
|
+
if (templateResult.length === 0) {
|
|
56
|
+
console.warn(`Template not found for id: ${templateId}`);
|
|
57
|
+
continue;
|
|
47
58
|
}
|
|
48
|
-
|
|
49
|
-
|
|
59
|
+
|
|
60
|
+
const templateCode = templateResult[0].code;
|
|
61
|
+
|
|
62
|
+
// Create Action-Template Mapping
|
|
63
|
+
const actionTemplateMapping = {
|
|
64
|
+
stg_act_mapping_id: stageActionMappingData.id,
|
|
65
|
+
template_code: templateCode,
|
|
66
|
+
entity_type: 'ATMP',
|
|
67
|
+
} as any;
|
|
68
|
+
|
|
69
|
+
await super.createEntity(
|
|
70
|
+
actionTemplateMapping,
|
|
71
|
+
loggedInUser,
|
|
72
|
+
manager,
|
|
73
|
+
appcode,
|
|
74
|
+
);
|
|
75
|
+
}
|
|
50
76
|
}
|
|
77
|
+
|
|
78
|
+
return actionData;
|
|
79
|
+
}
|
|
51
80
|
}
|
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { BaseEntity } from 'src/module/meta/entity/base-entity.entity';
|
|
2
3
|
import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
|
|
4
|
+
import { UserData } from 'src/module/user/entity/user.entity';
|
|
5
|
+
import { DataSource, EntityManager } from 'typeorm';
|
|
3
6
|
|
|
4
7
|
@Injectable()
|
|
5
|
-
export class StageService extends EntityServiceImpl {
|
|
8
|
+
export class StageService extends EntityServiceImpl {
|
|
9
|
+
constructor(private readonly dataSource: DataSource) {
|
|
10
|
+
super();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async createEntity(
|
|
14
|
+
entityData: BaseEntity,
|
|
15
|
+
loggedInUser: UserData | null,
|
|
16
|
+
manager?: EntityManager | null,
|
|
17
|
+
appcode?: string,
|
|
18
|
+
): Promise<any> {
|
|
19
|
+
const stageData = entityData as any;
|
|
20
|
+
|
|
21
|
+
// Step 1: Get the stage_group name using stage_group_id
|
|
22
|
+
let stageGroupName = '';
|
|
23
|
+
if (stageData.stage_group_id) {
|
|
24
|
+
const result = await this.dataSource.query(
|
|
25
|
+
`SELECT name FROM cr_wf_stage_group WHERE id = ?`,
|
|
26
|
+
[stageData.stage_group_id],
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
if (result.length > 0) {
|
|
30
|
+
stageGroupName = result[0].name;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (stageGroupName && stageData.name) {
|
|
35
|
+
stageData.full_name = `${stageGroupName}-${stageData.name}`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const savedStage = await super.createEntity(
|
|
39
|
+
stageData,
|
|
40
|
+
loggedInUser,
|
|
41
|
+
manager,
|
|
42
|
+
appcode,
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
return savedStage;
|
|
46
|
+
}
|
|
47
|
+
}
|