rez_core 5.0.245 → 5.0.246
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module/workflow/repository/action-data.repository.js +3 -3
- package/dist/module/workflow/repository/action-data.repository.js.map +1 -1
- package/dist/module/workflow/service/workflow-meta.service.js +21 -21
- package/dist/module/workflow/service/workflow-meta.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/workflow/repository/action-data.repository.ts +3 -3
- package/src/module/workflow/service/workflow-meta.service.ts +32 -29
package/package.json
CHANGED
|
@@ -85,7 +85,7 @@ export class ActionDataRepository extends EntityServiceImpl {
|
|
|
85
85
|
where: {
|
|
86
86
|
value: 'TO_BE_SENT',
|
|
87
87
|
enterprise_id: loggedInUser.enterprise_id,
|
|
88
|
-
listtype:'FRS'
|
|
88
|
+
listtype: 'FRS',
|
|
89
89
|
},
|
|
90
90
|
select: ['id'],
|
|
91
91
|
});
|
|
@@ -311,9 +311,9 @@ export class ActionDataRepository extends EntityServiceImpl {
|
|
|
311
311
|
loggedInUser: JSON.stringify(loggedInUser),
|
|
312
312
|
}).toString();
|
|
313
313
|
|
|
314
|
-
const {
|
|
314
|
+
const { organization_id } = loggedInUser;
|
|
315
315
|
|
|
316
|
-
const url = `${baseUrl}/organization/public/${
|
|
316
|
+
const url = `${baseUrl}/organization/public/${organization_id}?entity_type=ORGP&${queryParams}`;
|
|
317
317
|
|
|
318
318
|
const response = await axios.get(url);
|
|
319
319
|
|
|
@@ -38,9 +38,9 @@ export class WorkflowMetaService extends EntityServiceImpl {
|
|
|
38
38
|
@InjectRepository(StageGroup)
|
|
39
39
|
private readonly stageGroupRepo: Repository<StageGroup>,
|
|
40
40
|
@InjectRepository(ActionDataEntity)
|
|
41
|
-
private readonly actionDataEntityRepository:Repository<ActionDataEntity>,
|
|
41
|
+
private readonly actionDataEntityRepository: Repository<ActionDataEntity>,
|
|
42
42
|
@InjectRepository(TaskDataEntity)
|
|
43
|
-
private readonly taskDataEntityRepository:Repository<TaskDataEntity>,
|
|
43
|
+
private readonly taskDataEntityRepository: Repository<TaskDataEntity>,
|
|
44
44
|
) {
|
|
45
45
|
super();
|
|
46
46
|
}
|
|
@@ -224,7 +224,8 @@ export class WorkflowMetaService extends EntityServiceImpl {
|
|
|
224
224
|
);
|
|
225
225
|
|
|
226
226
|
for (const action of stageActions) {
|
|
227
|
-
const actionCategoryRepo =
|
|
227
|
+
const actionCategoryRepo =
|
|
228
|
+
this.reflectionHelper.getRepoService('ActionCategory');
|
|
228
229
|
const actionCategory = await actionCategoryRepo.findOne({
|
|
229
230
|
where: {
|
|
230
231
|
id: Number(action.action_category),
|
|
@@ -345,7 +346,8 @@ export class WorkflowMetaService extends EntityServiceImpl {
|
|
|
345
346
|
},
|
|
346
347
|
});
|
|
347
348
|
|
|
348
|
-
const listMasterItemsRepo =
|
|
349
|
+
const listMasterItemsRepo =
|
|
350
|
+
this.reflectionHelper.getRepoService('ListMasterItems');
|
|
349
351
|
|
|
350
352
|
const assignmentType = await listMasterItemsRepo.findOne({
|
|
351
353
|
where: {
|
|
@@ -371,7 +373,7 @@ export class WorkflowMetaService extends EntityServiceImpl {
|
|
|
371
373
|
|
|
372
374
|
if (
|
|
373
375
|
actionCategory?.code == 'OWAS' &&
|
|
374
|
-
assignmentType
|
|
376
|
+
assignmentType?.value == 'round_robin'
|
|
375
377
|
) {
|
|
376
378
|
console.log('Auto-assigning owner based on round-robin assignment type');
|
|
377
379
|
await this.assignLead(
|
|
@@ -415,13 +417,14 @@ export class WorkflowMetaService extends EntityServiceImpl {
|
|
|
415
417
|
loggedInUser,
|
|
416
418
|
);
|
|
417
419
|
|
|
418
|
-
const listMasterItemsRepo =
|
|
420
|
+
const listMasterItemsRepo =
|
|
421
|
+
this.reflectionHelper.getRepoService('ListMasterItems');
|
|
419
422
|
const unassignedListMasterItemData = await listMasterItemsRepo.find({
|
|
420
423
|
where: {
|
|
421
424
|
listtype: 'LEST',
|
|
422
425
|
enterprise_id: loggedInUser.enterprise_id,
|
|
423
|
-
value: In(['unassigned', 'active'])
|
|
424
|
-
}
|
|
426
|
+
value: In(['unassigned', 'active']),
|
|
427
|
+
},
|
|
425
428
|
});
|
|
426
429
|
|
|
427
430
|
// Find the IDs explicitly
|
|
@@ -451,21 +454,22 @@ export class WorkflowMetaService extends EntityServiceImpl {
|
|
|
451
454
|
.createQueryBuilder()
|
|
452
455
|
.update()
|
|
453
456
|
.set({ user_id: lead_owner })
|
|
454
|
-
.where(
|
|
455
|
-
.andWhere(
|
|
456
|
-
.andWhere(
|
|
457
|
+
.where('mapped_entity_id = :leadId', { leadId: lead_id })
|
|
458
|
+
.andWhere('mapped_entity_type = :entityType', { entityType: entity_type })
|
|
459
|
+
.andWhere('stage_id = :stageId', { stageId: stage_id })
|
|
457
460
|
.andWhere("(is_current = 'Y' OR is_current IS NULL)")
|
|
458
461
|
.execute();
|
|
459
462
|
|
|
460
|
-
const leadMeetingRepo =
|
|
463
|
+
const leadMeetingRepo =
|
|
464
|
+
this.reflectionHelper.getRepoService('LeadScheduleMeet');
|
|
461
465
|
|
|
462
466
|
await leadMeetingRepo
|
|
463
467
|
.createQueryBuilder()
|
|
464
468
|
.update()
|
|
465
469
|
.set({ user_id: lead_owner })
|
|
466
|
-
.where(
|
|
467
|
-
.andWhere(
|
|
468
|
-
.andWhere(
|
|
470
|
+
.where('stage_id = :stageId', { stageId: stage_id })
|
|
471
|
+
.andWhere('mapped_entity_id = :leadId', { leadId: lead_id })
|
|
472
|
+
.andWhere('mapped_entity_type = :entityType', { entityType: 'LEAD' })
|
|
469
473
|
.andWhere("(status = 'scheduled' OR status = 'rescheduled')")
|
|
470
474
|
.execute();
|
|
471
475
|
|
|
@@ -473,15 +477,15 @@ export class WorkflowMetaService extends EntityServiceImpl {
|
|
|
473
477
|
where: {
|
|
474
478
|
mapped_entity_id: lead_id,
|
|
475
479
|
mapped_entity_type: entity_type,
|
|
476
|
-
stage_id
|
|
477
|
-
}
|
|
480
|
+
stage_id,
|
|
481
|
+
},
|
|
478
482
|
});
|
|
479
483
|
|
|
480
484
|
for (const task of taskRows) {
|
|
481
485
|
const statusRows = await listMasterItemsRepo.findOne({
|
|
482
486
|
where: {
|
|
483
|
-
id: task.status
|
|
484
|
-
}
|
|
487
|
+
id: task.status,
|
|
488
|
+
},
|
|
485
489
|
});
|
|
486
490
|
|
|
487
491
|
const statusName = statusRows?.value?.toLowerCase() || '';
|
|
@@ -489,10 +493,9 @@ export class WorkflowMetaService extends EntityServiceImpl {
|
|
|
489
493
|
['todo', 'in_progress'].includes(statusName) ||
|
|
490
494
|
statusName === 'todo'
|
|
491
495
|
) {
|
|
492
|
-
|
|
493
|
-
await this.taskDataEntityRepository.update(task.id,{
|
|
496
|
+
await this.taskDataEntityRepository.update(task.id, {
|
|
494
497
|
user_id: lead_owner,
|
|
495
|
-
task_owner: lead_owner
|
|
498
|
+
task_owner: lead_owner,
|
|
496
499
|
});
|
|
497
500
|
}
|
|
498
501
|
}
|
|
@@ -581,13 +584,13 @@ export class WorkflowMetaService extends EntityServiceImpl {
|
|
|
581
584
|
|
|
582
585
|
const leadRepo = this.reflectionHelper.getRepoService('CRMLead');
|
|
583
586
|
const lastRow = await leadRepo
|
|
584
|
-
.createQueryBuilder(
|
|
585
|
-
.select(
|
|
586
|
-
.where(
|
|
587
|
-
.andWhere(
|
|
588
|
-
.andWhere(
|
|
589
|
-
.andWhere(
|
|
590
|
-
.orderBy(
|
|
587
|
+
.createQueryBuilder('cl')
|
|
588
|
+
.select('cl.lead_owner', 'lead_owner')
|
|
589
|
+
.where('cl.organization_id = :orgId', { orgId: organization_id })
|
|
590
|
+
.andWhere('cl.level_id = :levelId', { levelId: Number(level_id) })
|
|
591
|
+
.andWhere('cl.level_type = :levelType', { levelType: level_type })
|
|
592
|
+
.andWhere('cl.lead_owner IN (:...owners)', { owners: userIds })
|
|
593
|
+
.orderBy('cl.created_date', 'DESC')
|
|
591
594
|
.limit(1)
|
|
592
595
|
.getRawOne();
|
|
593
596
|
|