rez_core 5.0.293 → 5.0.295
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-automation/service/schedule-handler.service.d.ts +2 -2
- package/dist/module/workflow-automation/service/schedule-handler.service.js +12 -12
- package/dist/module/workflow-automation/service/schedule-handler.service.js.map +1 -1
- package/dist/module/workflow-schedule/interfaces/schedule-job-data.interface.d.ts +1 -0
- package/dist/module/workflow-schedule/service/workflow-schedule.service.js +2 -0
- package/dist/module/workflow-schedule/service/workflow-schedule.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/workflow-automation/service/schedule-handler.service.ts +12 -12
- package/src/module/workflow-schedule/interfaces/schedule-job-data.interface.ts +1 -0
- package/src/module/workflow-schedule/service/workflow-schedule.service.ts +2 -0
package/package.json
CHANGED
|
@@ -23,16 +23,16 @@ export class ScheduleHandlerService {
|
|
|
23
23
|
private readonly listMasterRepo: Repository<ListMasterData>,
|
|
24
24
|
) {}
|
|
25
25
|
|
|
26
|
-
async scheduleQueryBuilder(
|
|
26
|
+
async scheduleQueryBuilder(workflow_id: number, jobData: any) {
|
|
27
27
|
// 1️⃣ Fetch workflow automation config
|
|
28
28
|
const workflow = await this.workflowAutomation.findOne({
|
|
29
29
|
where: {
|
|
30
|
-
id:
|
|
31
|
-
organization_id: jobData.
|
|
30
|
+
id: workflow_id,
|
|
31
|
+
organization_id: jobData.organization_id,
|
|
32
32
|
},
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
if (!workflow) throw new Error(`Workflow with ID ${
|
|
35
|
+
if (!workflow) throw new Error(`Workflow with ID ${workflow_id} not found`);
|
|
36
36
|
|
|
37
37
|
const scheduleJson =
|
|
38
38
|
typeof workflow.schedule === 'string'
|
|
@@ -45,7 +45,7 @@ export class ScheduleHandlerService {
|
|
|
45
45
|
const entity = await this.entityMasterRepository.findOne({
|
|
46
46
|
where: {
|
|
47
47
|
mapped_entity_type: entityType,
|
|
48
|
-
organization_id: jobData.
|
|
48
|
+
organization_id: jobData.organization_id,
|
|
49
49
|
},
|
|
50
50
|
select: ['db_table_name'],
|
|
51
51
|
});
|
|
@@ -100,7 +100,7 @@ export class ScheduleHandlerService {
|
|
|
100
100
|
.select('e.*')
|
|
101
101
|
.where(comparisonDateCondition)
|
|
102
102
|
.andWhere('e.organization_id = :orgId', {
|
|
103
|
-
orgId: jobData.
|
|
103
|
+
orgId: jobData.organization_id,
|
|
104
104
|
});
|
|
105
105
|
|
|
106
106
|
this.logger.debug(`Executing Scheduler Query: ${qb.getSql()}`);
|
|
@@ -115,19 +115,19 @@ export class ScheduleHandlerService {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
// ⚙️ Step 2: Handle scheduled automation (main entry point)
|
|
118
|
-
async handleScheduledWorkflow(
|
|
118
|
+
async handleScheduledWorkflow(workflow_id: number, jobData: any) {
|
|
119
119
|
const { results, workflow, tableName } = await this.scheduleQueryBuilder(
|
|
120
|
-
|
|
120
|
+
workflow_id,
|
|
121
121
|
jobData,
|
|
122
122
|
);
|
|
123
123
|
|
|
124
124
|
if (!results?.length) {
|
|
125
|
-
this.logger.warn(`No records found for scheduled workflow ${
|
|
125
|
+
this.logger.warn(`No records found for scheduled workflow ${workflow_id}`);
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
this.logger.log(
|
|
130
|
-
`Processing ${results.length} records for workflow ${
|
|
130
|
+
`Processing ${results.length} records for workflow ${workflow_id}`,
|
|
131
131
|
);
|
|
132
132
|
|
|
133
133
|
// Parse the workflow event JSON again to get filter/action info
|
|
@@ -157,7 +157,7 @@ export class ScheduleHandlerService {
|
|
|
157
157
|
|
|
158
158
|
// 🧮 Step 3: Execute workflow actions for matched entities
|
|
159
159
|
if (!matchedEntities.length) {
|
|
160
|
-
this.logger.log(`No records passed criteria for workflow ${
|
|
160
|
+
this.logger.log(`No records passed criteria for workflow ${workflow_id}`);
|
|
161
161
|
return;
|
|
162
162
|
}
|
|
163
163
|
|
|
@@ -167,7 +167,7 @@ export class ScheduleHandlerService {
|
|
|
167
167
|
|
|
168
168
|
for (const entity of matchedEntities) {
|
|
169
169
|
await this.workflowAutomationEngineService.executeActions(
|
|
170
|
-
|
|
170
|
+
workflow_id,
|
|
171
171
|
entity,
|
|
172
172
|
jobData,
|
|
173
173
|
);
|
|
@@ -368,6 +368,7 @@ export class WorkflowScheduleService {
|
|
|
368
368
|
const schedule = await this.getScheduleById(scheduleId);
|
|
369
369
|
|
|
370
370
|
const jobData: ScheduleJobData = {
|
|
371
|
+
id:loggedInUser.id,
|
|
371
372
|
schedule_id: schedule.id,
|
|
372
373
|
workflow_id: schedule.workflow_id,
|
|
373
374
|
workflow_name: schedule.workflow_name,
|
|
@@ -520,6 +521,7 @@ export class WorkflowScheduleService {
|
|
|
520
521
|
*/
|
|
521
522
|
private async scheduleJob(schedule: ScheduledWorkflow, loggedInUser: UserData): Promise<void> {
|
|
522
523
|
const jobData: ScheduleJobData = {
|
|
524
|
+
id:loggedInUser.id,
|
|
523
525
|
schedule_id: schedule.id,
|
|
524
526
|
workflow_id: schedule.workflow_id,
|
|
525
527
|
workflow_name: schedule.workflow_name,
|