rez_core 5.0.96 → 5.0.98

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "5.0.96",
3
+ "version": "5.0.98",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -982,9 +982,12 @@ export class FilterService {
982
982
 
983
983
  const dayBefore = (() => {
984
984
  const d = new Date();
985
- d.setDate(d.getDate() - numVal);
986
- return d.toISOString().split('T')[0];
985
+ d.setDate(d.getDate() - (numVal));
986
+
987
+ // Format as YYYY-MM-DD in IST
988
+ return d.toLocaleDateString('en-CA', { timeZone: 'Asia/Kolkata' });
987
989
  })();
990
+
988
991
 
989
992
  return {
990
993
  query: `${dateColumn} <= :${key}`,
@@ -8,9 +8,7 @@ import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.s
8
8
  import { FORM_STATUS_TO_BE_SENT } from 'src/constant/global.constant';
9
9
  import { ConfigService } from '@nestjs/config';
10
10
  import axios from 'axios';
11
- import {
12
- WorkflowAutomationEngineService,
13
- } from 'src/module/workflow-automation/service/workflow-automation-engine.service';
11
+ import { WorkflowAutomationEngineService } from 'src/module/workflow-automation/service/workflow-automation-engine.service';
14
12
 
15
13
  @Injectable()
16
14
  export class ActionDataRepository extends EntityServiceImpl {
@@ -38,7 +36,8 @@ export class ActionDataRepository extends EntityServiceImpl {
38
36
 
39
37
  if (action.length > 0) {
40
38
  for (const act of action) {
41
- const listMasterItemsRepo = this.reflectionHelper.getRepoService('ListMasterItems');
39
+ const listMasterItemsRepo =
40
+ this.reflectionHelper.getRepoService('ListMasterItems');
42
41
  const is_mandatory = await listMasterItemsRepo.findOne({
43
42
  where: {
44
43
  id: act.action_requirement,
@@ -103,7 +102,8 @@ export class ActionDataRepository extends EntityServiceImpl {
103
102
  );
104
103
  // THEN INSERT SDFM IN RELATION TASK TABLE
105
104
 
106
- const entityRelationRepo = this.reflectionHelper.getRepoService('EntityRelation');
105
+ const entityRelationRepo =
106
+ this.reflectionHelper.getRepoService('EntityRelation');
107
107
  let relationData = await entityRelationRepo.findOne({
108
108
  where: {
109
109
  source_entity_type: createdEntity.mapped_entity_type,
@@ -112,7 +112,8 @@ export class ActionDataRepository extends EntityServiceImpl {
112
112
  });
113
113
 
114
114
  if (relationData) {
115
- const entityRelationDataRepo = this.reflectionHelper.getRepoService('EntityRelationData');
115
+ const entityRelationDataRepo =
116
+ this.reflectionHelper.getRepoService('EntityRelationData');
116
117
 
117
118
  await entityRelationDataRepo.save({
118
119
  organization_id: loggedInUser.organization_id,
@@ -261,7 +262,8 @@ export class ActionDataRepository extends EntityServiceImpl {
261
262
  task.is_done = false;
262
263
 
263
264
  // Reset status (optional: set to something like 'pending' if needed)
264
- const listMasterItemRepo = this.reflectionHelper.getRepoService('ListMasterItems');
265
+ const listMasterItemRepo =
266
+ this.reflectionHelper.getRepoService('ListMasterItems');
265
267
  const listMasterItem = await listMasterItemRepo.findOne({
266
268
  where: {
267
269
  code: 'in_progress',
@@ -313,7 +315,7 @@ export class ActionDataRepository extends EntityServiceImpl {
313
315
  console.error('Internal Entity API call failed:', error.message);
314
316
  }
315
317
 
316
- const org_slug = organizationData[0]?.slug;
318
+ const org_slug = organizationData?.slug;
317
319
 
318
320
  // fetch required var from config or env
319
321
  const profile = this.configService.get('PROFILE');
@@ -189,7 +189,7 @@ export class StageMovementRepository {
189
189
  const actionRepo = this.reflectionHelper.getRepoService('ActionEntity');
190
190
  const result = await actionRepo
191
191
  .createQueryBuilder('a')
192
- .leftJoin(
192
+ .innerJoin(
193
193
  'frm_wf_stage_action_mapping',
194
194
  'm',
195
195
  'a.id = m.action_id::bigint',
@@ -199,12 +199,18 @@ export class StageMovementRepository {
199
199
  'ac',
200
200
  'a.action_category::bigint = ac.id',
201
201
  )
202
+ .leftJoin(
203
+ 'frm_wf_action_resources_mapping',
204
+ 'arm',
205
+ 'm.id = arm.stg_act_mapping_id::bigint',
206
+ )
202
207
  .where('m.stage_id::bigint = :stageId', { stageId: Number(stageId) })
203
208
  .select([
204
- 'a.*', // select all columns from action table
209
+ 'a.*',
205
210
  'm.id AS mapping_id',
206
211
  'm.stage_id AS stage_id',
207
212
  'ac.code AS action_category_code',
213
+ 'arm.form_id AS form_id',
208
214
  ])
209
215
  .orderBy('a.sequence', 'ASC')
210
216
  .getRawMany();
@@ -116,16 +116,25 @@ export class ActionTemplateMappingService extends EntityServiceImpl {
116
116
  'ct.name AS label',
117
117
  'ct.id AS id',
118
118
  ])
119
+ .innerJoin(
120
+ 'frm_list_master_items',
121
+ 'fmi',
122
+ `fmi.id = ct.status::bigint
123
+ AND fmi.code = 'STATUS_ACTIVE'
124
+ AND fmi.organization_id::text = :orgId`,
125
+ { orgId: String(loggedInUser.organization_id) }
126
+ )
119
127
  .where('ct.code IN (:...codes)', { codes: templateCodes })
120
128
  .andWhere('ct.mode::text = :mode', { mode: String(mode) })
121
- .andWhere('ct.organization_id = :orgId', { orgId: loggedInUser.organization_id })
122
- .andWhere('ct.level_type = :levelType', { levelType: loggedInUser.level_type })
123
- .andWhere('ct.level_id = :levelId', { levelId: Number(loggedInUser.level_id) })
124
- .andWhere(`ct.status IN (
125
- SELECT id FROM frm_list_master_items
126
- WHERE code = 'STATUS_ACTIVE'
127
- AND organization_id = :orgId2
128
- )`, { orgId2: loggedInUser.organization_id })
129
+ .andWhere('ct.organization_id::text = :orgId', {
130
+ orgId: String(loggedInUser.organization_id),
131
+ })
132
+ .andWhere('ct.level_type = :levelType', {
133
+ levelType: loggedInUser.level_type,
134
+ })
135
+ .andWhere('ct.level_id::text = :levelId', {
136
+ levelId: String(loggedInUser.level_id),
137
+ })
129
138
  .getRawMany();
130
139
  }
131
140
  }