rez_core 2.1.109 → 2.1.111
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 +10 -0
- package/dist/constant/global.constant.js +11 -1
- package/dist/constant/global.constant.js.map +1 -1
- package/dist/module/listmaster/controller/list-master.controller.d.ts +3 -0
- package/dist/module/listmaster/controller/list-master.controller.js +16 -0
- package/dist/module/listmaster/controller/list-master.controller.js.map +1 -1
- package/dist/module/listmaster/repository/list-master-items.repository.d.ts +1 -0
- package/dist/module/listmaster/repository/list-master-items.repository.js +3 -0
- package/dist/module/listmaster/repository/list-master-items.repository.js.map +1 -1
- package/dist/module/listmaster/service/list-master-item.service.d.ts +5 -2
- package/dist/module/listmaster/service/list-master-item.service.js +48 -3
- package/dist/module/listmaster/service/list-master-item.service.js.map +1 -1
- package/dist/module/master/controller/master.controller.d.ts +1 -1
- package/dist/module/master/controller/master.controller.js +0 -2
- package/dist/module/master/controller/master.controller.js.map +1 -1
- package/dist/module/master/service/master.service.d.ts +1 -1
- package/dist/module/master/service/master.service.js +5 -1
- package/dist/module/master/service/master.service.js.map +1 -1
- package/dist/module/meta/entity/attribute-master.entity.d.ts +1 -0
- package/dist/module/meta/entity/attribute-master.entity.js +4 -0
- package/dist/module/meta/entity/attribute-master.entity.js.map +1 -1
- package/dist/module/meta/repository/attribute-master.repository.d.ts +2 -1
- package/dist/module/meta/repository/attribute-master.repository.js +5 -3
- package/dist/module/meta/repository/attribute-master.repository.js.map +1 -1
- package/dist/module/meta/service/attribute-master.service.d.ts +2 -1
- package/dist/module/meta/service/attribute-master.service.js +2 -2
- package/dist/module/meta/service/attribute-master.service.js.map +1 -1
- package/dist/module/user/service/role.service.js +2 -2
- package/dist/module/user/service/role.service.js.map +1 -1
- 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 +6 -0
- package/dist/module/workflow/entity/action-category.entity.js +35 -0
- package/dist/module/workflow/entity/action-category.entity.js.map +1 -0
- package/dist/module/workflow/entity/action-template-mapping.entity.d.ts +6 -0
- package/dist/module/workflow/entity/action-template-mapping.entity.js +35 -0
- package/dist/module/workflow/entity/action-template-mapping.entity.js.map +1 -0
- package/dist/module/workflow/entity/action.entity.d.ts +7 -0
- package/dist/module/workflow/entity/action.entity.js +39 -0
- package/dist/module/workflow/entity/action.entity.js.map +1 -0
- package/dist/module/workflow/entity/comm-template.entity.d.ts +4 -0
- package/dist/module/workflow/entity/comm-template.entity.js +27 -0
- package/dist/module/workflow/entity/comm-template.entity.js.map +1 -0
- package/dist/module/workflow/entity/stage-action-mapping.entity.d.ts +6 -0
- package/dist/module/workflow/entity/stage-action-mapping.entity.js +35 -0
- package/dist/module/workflow/entity/stage-action-mapping.entity.js.map +1 -0
- package/dist/module/workflow/entity/stage-group.entity.d.ts +6 -0
- package/dist/module/workflow/entity/stage-group.entity.js +35 -0
- package/dist/module/workflow/entity/stage-group.entity.js.map +1 -0
- 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 +7 -0
- package/dist/module/workflow/entity/stage.entity.js +39 -0
- package/dist/module/workflow/entity/stage.entity.js.map +1 -0
- 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/entity/workflow.entity.d.ts +5 -0
- package/dist/module/workflow/entity/workflow.entity.js +31 -0
- package/dist/module/workflow/entity/workflow.entity.js.map +1 -0
- package/dist/module/workflow/repository/workflow.repository.d.ts +2 -0
- package/dist/module/workflow/repository/workflow.repository.js +17 -0
- package/dist/module/workflow/repository/workflow.repository.js.map +1 -0
- package/dist/module/workflow/service/action-category.service.d.ts +3 -0
- package/dist/module/workflow/service/action-category.service.js +18 -0
- package/dist/module/workflow/service/action-category.service.js.map +1 -0
- package/dist/module/workflow/service/action-template-mapping.service.d.ts +3 -0
- package/dist/module/workflow/service/action-template-mapping.service.js +18 -0
- package/dist/module/workflow/service/action-template-mapping.service.js.map +1 -0
- package/dist/module/workflow/service/action.service.d.ts +9 -0
- package/dist/module/workflow/service/action.service.js +57 -0
- package/dist/module/workflow/service/action.service.js.map +1 -0
- package/dist/module/workflow/service/comm-template.service.d.ts +3 -0
- package/dist/module/workflow/service/comm-template.service.js +18 -0
- package/dist/module/workflow/service/comm-template.service.js.map +1 -0
- package/dist/module/workflow/service/stage-action-mapping.service.d.ts +3 -0
- package/dist/module/workflow/service/stage-action-mapping.service.js +18 -0
- package/dist/module/workflow/service/stage-action-mapping.service.js.map +1 -0
- package/dist/module/workflow/service/stage-group.service.d.ts +3 -0
- package/dist/module/workflow/service/stage-group.service.js +18 -0
- package/dist/module/workflow/service/stage-group.service.js.map +1 -0
- package/dist/module/workflow/service/stage.service.d.ts +9 -0
- package/dist/module/workflow/service/stage.service.js +42 -0
- package/dist/module/workflow/service/stage.service.js.map +1 -0
- 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.d.ts +4 -0
- package/dist/module/workflow/service/workflow.service.js +25 -0
- package/dist/module/workflow/service/workflow.service.js.map +1 -0
- package/dist/module/workflow/workflow.module.d.ts +2 -0
- package/dist/module/workflow/workflow.module.js +79 -0
- package/dist/module/workflow/workflow.module.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/app.module.ts +2 -0
- package/src/constant/global.constant.ts +12 -0
- package/src/module/listmaster/controller/list-master.controller.ts +18 -0
- package/src/module/listmaster/repository/list-master-items.repository.ts +4 -0
- package/src/module/listmaster/service/list-master-item.service.ts +99 -2
- package/src/module/master/controller/master.controller.ts +1 -1
- package/src/module/master/service/master.service.ts +6 -1
- package/src/module/meta/entity/attribute-master.entity.ts +3 -0
- package/src/module/meta/repository/attribute-master.repository.ts +6 -3
- package/src/module/meta/service/attribute-master.service.ts +6 -4
- package/src/module/user/service/role.service.ts +2 -2
- package/src/module/workflow/controller/workflow-list-master.controller.ts +25 -0
- package/src/module/workflow/entity/action-category.entity.ts +17 -0
- package/src/module/workflow/entity/action-template-mapping.entity.ts +17 -0
- package/src/module/workflow/entity/action.entity.ts +20 -0
- package/src/module/workflow/entity/comm-template.entity.ts +11 -0
- package/src/module/workflow/entity/stage-action-mapping.entity.ts +17 -0
- package/src/module/workflow/entity/stage-group.entity.ts +17 -0
- package/src/module/workflow/entity/stage-movement-data.entity.ts +26 -0
- package/src/module/workflow/entity/stage.entity.ts +20 -0
- package/src/module/workflow/entity/workflow-data.entity.ts +11 -0
- package/src/module/workflow/entity/workflow.entity.ts +14 -0
- package/src/module/workflow/repository/workflow.repository.ts +4 -0
- package/src/module/workflow/service/action-category.service.ts +5 -0
- package/src/module/workflow/service/action-template-mapping.service.ts +5 -0
- package/src/module/workflow/service/action.service.ts +80 -0
- package/src/module/workflow/service/comm-template.service.ts +5 -0
- package/src/module/workflow/service/stage-action-mapping.service.ts +5 -0
- package/src/module/workflow/service/stage-group.service.ts +5 -0
- package/src/module/workflow/service/stage.service.ts +47 -0
- package/src/module/workflow/service/workflow-list-master.service.ts +44 -0
- package/src/module/workflow/service/workflow.service.ts +9 -0
- package/src/module/workflow/workflow.module.ts +66 -0
- package/src/resources/dev.properties.yaml +1 -1
package/package.json
CHANGED
package/src/app.module.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { ThirdPartyModule } from './module/third-party-module/third-party.module
|
|
|
13
13
|
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
|
+
import { WorkflowModule } from './module/workflow/workflow.module';
|
|
16
17
|
|
|
17
18
|
@Module({
|
|
18
19
|
imports: [
|
|
@@ -30,6 +31,7 @@ import { LayoutPreferenceModule } from './module/layout_preference/layout_prefer
|
|
|
30
31
|
FilterModule,
|
|
31
32
|
LeadModule,
|
|
32
33
|
LayoutPreferenceModule,
|
|
34
|
+
WorkflowModule,
|
|
33
35
|
],
|
|
34
36
|
})
|
|
35
37
|
export class AppModule {}
|
|
@@ -34,3 +34,15 @@ export const ENTITYSTATUS_PUBLISHED = 'published';
|
|
|
34
34
|
export const DISPLAY_LIST = 'LIST';
|
|
35
35
|
export const DISPLAY_EXPORT = 'EXPORT';
|
|
36
36
|
export const DISPLAY_REPORT = 'REPORT';
|
|
37
|
+
|
|
38
|
+
//WorkFlow Type
|
|
39
|
+
export const WORKFLOW = 'WRFW';
|
|
40
|
+
export const ACTION = 'ACTN';
|
|
41
|
+
export const STAGE = 'STG';
|
|
42
|
+
export const STAGE_GROUP = 'STGP';
|
|
43
|
+
export const ACTION_CATEGORY = 'ACTC';
|
|
44
|
+
export const STAGE_ACTION_MAPPING = 'STGM';
|
|
45
|
+
export const COMM_TEMPLATE = 'CTPL';
|
|
46
|
+
export const ACTION_TEMPLATE_MAPPING = 'ATMP';
|
|
47
|
+
export const WORKFLOW_DATA = 'WFDT';
|
|
48
|
+
export const STAGE_MOVEMENT_DATA = 'STMV';
|
|
@@ -50,6 +50,24 @@ export class ListMasterController {
|
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
|
|
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
|
+
|
|
64
|
+
return await this.listMasterItemService.getResolvedListMasterItems(
|
|
65
|
+
loggedInUser,
|
|
66
|
+
entityData,
|
|
67
|
+
entityType,
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
53
71
|
@Get('/getListMasterItems/:type')
|
|
54
72
|
@UseGuards(JwtAuthGuard)
|
|
55
73
|
@HttpCode(HttpStatus.OK)
|
|
@@ -146,4 +146,8 @@ export class ListMasterItemsRepository {
|
|
|
146
146
|
async delete(item: Partial<ListMasterItems>) {
|
|
147
147
|
return this.repo.delete(item);
|
|
148
148
|
}
|
|
149
|
+
|
|
150
|
+
async findById(id: number): Promise<ListMasterItems | null> {
|
|
151
|
+
return this.repo.findOne({ where: { id } });
|
|
152
|
+
}
|
|
149
153
|
}
|
|
@@ -9,15 +9,19 @@ import { ListMasterItemsRepository } from '../repository/list-master-items.repos
|
|
|
9
9
|
import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
|
|
10
10
|
import { UserData } from 'src/module/user/entity/user.entity';
|
|
11
11
|
import { CodeGeneratorService } from 'src/utils/service/codeGenerator.service';
|
|
12
|
+
import { AttributeMasterService } from 'src/module/meta/service/attribute-master.service';
|
|
12
13
|
|
|
13
14
|
@Injectable()
|
|
14
|
-
export class ListMasterItemService {
|
|
15
|
+
export class ListMasterItemService extends EntityServiceImpl {
|
|
15
16
|
constructor(
|
|
16
17
|
private readonly listItemsRepo: ListMasterItemsRepository,
|
|
17
18
|
private readonly listMasterRepo: ListMasterItemsRepository,
|
|
18
19
|
@Inject(forwardRef(() => EntityServiceImpl))
|
|
19
20
|
private readonly entityServiceImpl: EntityServiceImpl,
|
|
20
|
-
|
|
21
|
+
private readonly attributeMasterService: AttributeMasterService,
|
|
22
|
+
) {
|
|
23
|
+
super();
|
|
24
|
+
}
|
|
21
25
|
|
|
22
26
|
async getListMasterItemsByType(
|
|
23
27
|
listType: string,
|
|
@@ -178,4 +182,97 @@ export class ListMasterItemService {
|
|
|
178
182
|
await this.listItemsRepo.delete({ code, listtype: listType });
|
|
179
183
|
return `Item with name ${code} deleted successfully from type ${listType}`;
|
|
180
184
|
}
|
|
185
|
+
|
|
186
|
+
// async getResolvedListMasterItems(
|
|
187
|
+
// loggedInUser: UserData,
|
|
188
|
+
// entityData: any,
|
|
189
|
+
// entityType: string,
|
|
190
|
+
// ): Promise<any> {
|
|
191
|
+
// const attributeItems =
|
|
192
|
+
// await this.attributeMasterService.findAttributesByMappedEntityType(
|
|
193
|
+
// entityType,
|
|
194
|
+
// loggedInUser,
|
|
195
|
+
// );
|
|
196
|
+
|
|
197
|
+
// const masterAttributes = attributeItems.filter(
|
|
198
|
+
// (attr) => attr.data_source_type === 'master',
|
|
199
|
+
// );
|
|
200
|
+
|
|
201
|
+
// const resolvedEntityData = { ...entityData };
|
|
202
|
+
|
|
203
|
+
// for (const attr of masterAttributes) {
|
|
204
|
+
// const field = attr.attribute_key;
|
|
205
|
+
// const codeValue = entityData[field];
|
|
206
|
+
// if (!codeValue) continue;
|
|
207
|
+
|
|
208
|
+
// const listItems = await this.listItemsRepo.findById(codeValue);
|
|
209
|
+
// if (!listItems) continue;
|
|
210
|
+
|
|
211
|
+
// }
|
|
212
|
+
|
|
213
|
+
// return resolvedEntityData;
|
|
214
|
+
// }
|
|
215
|
+
|
|
216
|
+
async getResolvedListMasterItems(
|
|
217
|
+
loggedInUser: UserData,
|
|
218
|
+
entityData: any,
|
|
219
|
+
entityType: string,
|
|
220
|
+
): Promise<any> {
|
|
221
|
+
const attributeItems =
|
|
222
|
+
await this.attributeMasterService.findAttributesByMappedEntityType(
|
|
223
|
+
entityType,
|
|
224
|
+
loggedInUser,
|
|
225
|
+
);
|
|
226
|
+
|
|
227
|
+
const resolvedEntityData = { ...entityData };
|
|
228
|
+
|
|
229
|
+
for (const attr of attributeItems) {
|
|
230
|
+
const field = attr.attribute_key;
|
|
231
|
+
const codeValue = entityData[field];
|
|
232
|
+
|
|
233
|
+
if (!codeValue) continue;
|
|
234
|
+
|
|
235
|
+
// ---------- ENTITY data_source_type ----------
|
|
236
|
+
if (attr.data_source_type === 'entity') {
|
|
237
|
+
if (Array.isArray(codeValue)) {
|
|
238
|
+
const resolvedValues: string[] = [];
|
|
239
|
+
for (const code of codeValue) {
|
|
240
|
+
const item = await super.getEntityData(
|
|
241
|
+
attr.datasource_list,
|
|
242
|
+
code,
|
|
243
|
+
loggedInUser,
|
|
244
|
+
);
|
|
245
|
+
resolvedValues.push(item?.[attr.data_source_attribute] ?? code);
|
|
246
|
+
}
|
|
247
|
+
resolvedEntityData[field] = resolvedValues;
|
|
248
|
+
} else {
|
|
249
|
+
const item = await super.getEntityData(
|
|
250
|
+
attr.datasource_list,
|
|
251
|
+
codeValue,
|
|
252
|
+
loggedInUser,
|
|
253
|
+
);
|
|
254
|
+
resolvedEntityData[field] =
|
|
255
|
+
item?.[attr.data_source_attribute] ?? codeValue;
|
|
256
|
+
}
|
|
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
|
+
|
|
276
|
+
return resolvedEntityData;
|
|
277
|
+
}
|
|
181
278
|
}
|
|
@@ -19,7 +19,7 @@ import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.s
|
|
|
19
19
|
import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard';
|
|
20
20
|
|
|
21
21
|
@Controller('master')
|
|
22
|
-
@UseGuards(JwtAuthGuard)
|
|
22
|
+
// @UseGuards(JwtAuthGuard)
|
|
23
23
|
export class MasterController {
|
|
24
24
|
constructor(
|
|
25
25
|
private readonly masterService: MasterService,
|
|
@@ -161,9 +161,14 @@ export class MasterService {
|
|
|
161
161
|
const entityMasterData =
|
|
162
162
|
await this.entityMasterService.getEntityByTableName(table);
|
|
163
163
|
|
|
164
|
+
if (!entityMasterData || !entityMasterData.mapped_entity_type) {
|
|
165
|
+
console.error('Entity master data or mapped entity type is missing');
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
|
|
164
169
|
const attributes =
|
|
165
170
|
await this.attributeMasterService.findAttributesByMappedEntityType(
|
|
166
|
-
entityMasterData
|
|
171
|
+
entityMasterData.mapped_entity_type,
|
|
167
172
|
loggedInUser.organization_id,
|
|
168
173
|
);
|
|
169
174
|
|
|
@@ -62,6 +62,9 @@ export class AttributeMaster extends BaseEntity {
|
|
|
62
62
|
@Column({ name: 'is_unique', nullable: true })
|
|
63
63
|
is_unique: number;
|
|
64
64
|
|
|
65
|
+
@Column({ name: 'data_source_attribute', nullable: true })
|
|
66
|
+
data_source_attribute: string;
|
|
67
|
+
|
|
65
68
|
@Column({ name: 'regex', nullable: true })
|
|
66
69
|
regex: string;
|
|
67
70
|
|
|
@@ -2,6 +2,7 @@ import { Injectable } from '@nestjs/common';
|
|
|
2
2
|
import { InjectRepository } from '@nestjs/typeorm';
|
|
3
3
|
import { AttributeMaster } from '../entity/attribute-master.entity';
|
|
4
4
|
import { In, Repository } from 'typeorm';
|
|
5
|
+
import { UserData } from 'src/module/user/entity/user.entity';
|
|
5
6
|
|
|
6
7
|
@Injectable()
|
|
7
8
|
export class AttributeMasterRepository {
|
|
@@ -28,12 +29,14 @@ export class AttributeMasterRepository {
|
|
|
28
29
|
|
|
29
30
|
async findAttributesByMappedEntityType(
|
|
30
31
|
entityType: string,
|
|
31
|
-
|
|
32
|
+
loggedInUser: UserData,
|
|
32
33
|
): Promise<AttributeMaster[]> {
|
|
33
34
|
return await this.attributeMasterRepository.find({
|
|
34
35
|
where: {
|
|
35
|
-
mapped_entity_type: In([entityType
|
|
36
|
-
organization_id:
|
|
36
|
+
mapped_entity_type: In([entityType]),
|
|
37
|
+
organization_id: loggedInUser.organization_id,
|
|
38
|
+
level_type: loggedInUser.level_type,
|
|
39
|
+
level_id: loggedInUser.level_id,
|
|
37
40
|
},
|
|
38
41
|
});
|
|
39
42
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Injectable } from '@nestjs/common';
|
|
2
|
-
import { InjectRepository } from '@nestjs/typeorm';
|
|
3
|
-
import { In } from 'typeorm';
|
|
4
2
|
import { AttributeMasterRepository } from '../repository/attribute-master.repository';
|
|
3
|
+
import { UserData } from 'src/module/user/entity/user.entity';
|
|
5
4
|
|
|
6
5
|
@Injectable()
|
|
7
6
|
export class AttributeMasterService {
|
|
@@ -9,10 +8,13 @@ export class AttributeMasterService {
|
|
|
9
8
|
private readonly attributeMasterRepository: AttributeMasterRepository,
|
|
10
9
|
) {}
|
|
11
10
|
|
|
12
|
-
async findAttributesByMappedEntityType(
|
|
11
|
+
async findAttributesByMappedEntityType(
|
|
12
|
+
entity_type: string,
|
|
13
|
+
loggedInUser: UserData,
|
|
14
|
+
) {
|
|
13
15
|
return await this.attributeMasterRepository.findAttributesByMappedEntityType(
|
|
14
16
|
entity_type,
|
|
15
|
-
|
|
17
|
+
loggedInUser,
|
|
16
18
|
);
|
|
17
19
|
}
|
|
18
20
|
}
|
|
@@ -44,7 +44,7 @@ export class RoleService extends EntityServiceImpl {
|
|
|
44
44
|
parseInt(loggedInUser?.level_id || '', 10),
|
|
45
45
|
})
|
|
46
46
|
) {
|
|
47
|
-
return { success: false, error: 'Role
|
|
47
|
+
return { success: false, error: 'Role name already exists.' };
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
const sourceRole = role.copy_from_role_id
|
|
@@ -95,7 +95,7 @@ export class RoleService extends EntityServiceImpl {
|
|
|
95
95
|
loggedInUser?.organization_id || 0,
|
|
96
96
|
);
|
|
97
97
|
|
|
98
|
-
if (entityData.status == resolveStatus.id
|
|
98
|
+
if (entityData.status == resolveStatus.id) {
|
|
99
99
|
//get role by id
|
|
100
100
|
const existingRole = await this.getEntityData(
|
|
101
101
|
ENTITYTYPE_ROLE,
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ACTION_CATEGORY } 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_action_category' })
|
|
6
|
+
export class ActionCategory extends BaseEntity {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.entity_type = ACTION_CATEGORY;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@Column({ type: 'varchar', nullable: true })
|
|
13
|
+
logo: string;
|
|
14
|
+
|
|
15
|
+
@Column({ type: 'varchar', nullable: true })
|
|
16
|
+
modalName: string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ACTION_TEMPLATE_MAPPING } 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_action_template_mapping' })
|
|
6
|
+
export class ActionTemplateMapping extends BaseEntity {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.entity_type = ACTION_TEMPLATE_MAPPING;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@Column({ type: 'int', nullable: true })
|
|
13
|
+
stg_act_mapping_id: number;
|
|
14
|
+
|
|
15
|
+
@Column({ type: 'varchar', nullable: true })
|
|
16
|
+
template_code: string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ACTION } 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_action' })
|
|
6
|
+
export class Action extends BaseEntity {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.entity_type = ACTION;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@Column({ type: 'int', nullable: true })
|
|
13
|
+
workflow_id: number;
|
|
14
|
+
|
|
15
|
+
@Column({ type: 'int', nullable: true })
|
|
16
|
+
action_cat_id: number;
|
|
17
|
+
|
|
18
|
+
@Column({ type: 'varchar', nullable: true })
|
|
19
|
+
action_requirement: string;
|
|
20
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { COMM_TEMPLATE } 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_wf_comm_template' })
|
|
6
|
+
export class CommTemplate extends BaseEntity {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.entity_type = COMM_TEMPLATE;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { STAGE_ACTION_MAPPING } 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_action_mapping' })
|
|
6
|
+
export class StageActionMapping extends BaseEntity {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.entity_type = STAGE_ACTION_MAPPING;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@Column({ type: 'int', nullable: true })
|
|
13
|
+
stage_id: number;
|
|
14
|
+
|
|
15
|
+
@Column({ type: 'int', nullable: true })
|
|
16
|
+
action_id: number;
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { STAGE_GROUP } 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_group' })
|
|
6
|
+
export class StageGroup extends BaseEntity {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.entity_type = STAGE_GROUP;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@Column({ type: 'int', nullable: true })
|
|
13
|
+
workflow_id: number;
|
|
14
|
+
|
|
15
|
+
@Column({ type: 'int', nullable: true })
|
|
16
|
+
sortindex: number;
|
|
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
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { STAGE } 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' })
|
|
6
|
+
export class Stage extends BaseEntity {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.entity_type = STAGE;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@Column({ type: 'int', nullable: true })
|
|
13
|
+
stage_group_id: number;
|
|
14
|
+
|
|
15
|
+
@Column({ type: 'varchar', length: 100, nullable: true })
|
|
16
|
+
full_name: string;
|
|
17
|
+
|
|
18
|
+
@Column({ type: 'int', nullable: true })
|
|
19
|
+
sortindex: number;
|
|
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
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { WORKFLOW } 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_workflow' })
|
|
6
|
+
export class Workflow extends BaseEntity {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.entity_type = WORKFLOW;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@Column({ type: 'varchar', nullable: true })
|
|
13
|
+
mapped_entity_type: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { BaseEntity } from 'src/module/meta/entity/base-entity.entity';
|
|
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';
|
|
6
|
+
|
|
7
|
+
@Injectable()
|
|
8
|
+
export class ActionService 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
|
+
console.log('entityData', entityData);
|
|
20
|
+
|
|
21
|
+
let actionData = entityData as any;
|
|
22
|
+
|
|
23
|
+
let action = await super.createEntity(
|
|
24
|
+
entityData,
|
|
25
|
+
loggedInUser,
|
|
26
|
+
manager,
|
|
27
|
+
appcode,
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
let stageActionMapping = {
|
|
31
|
+
action_id: action.id,
|
|
32
|
+
stage_id: actionData.stage_id,
|
|
33
|
+
entity_type: 'STGM',
|
|
34
|
+
} as any;
|
|
35
|
+
|
|
36
|
+
let stageActionMappingData = await super.createEntity(
|
|
37
|
+
stageActionMapping,
|
|
38
|
+
loggedInUser,
|
|
39
|
+
manager,
|
|
40
|
+
appcode,
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
if (Array.isArray(actionData.template) && actionData.template.length > 0) {
|
|
44
|
+
const templates = actionData.template;
|
|
45
|
+
|
|
46
|
+
for (let i = 0; i < templates.length; i++) {
|
|
47
|
+
const templateId = templates[i];
|
|
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
|
+
);
|
|
54
|
+
|
|
55
|
+
if (templateResult.length === 0) {
|
|
56
|
+
console.warn(`Template not found for id: ${templateId}`);
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
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
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return actionData;
|
|
79
|
+
}
|
|
80
|
+
}
|