rez_core 5.0.53 → 5.0.55

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.53",
3
+ "version": "5.0.55",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -895,6 +895,24 @@ export class FilterService {
895
895
  // convert to number when needed
896
896
  const numVal = Number(val);
897
897
 
898
+ // INSIDE buildDateCondition
899
+ const subtractBusinessDays = (days: number): string => {
900
+ let d = new Date();
901
+ let count = 0;
902
+
903
+ while (count < days) {
904
+ d.setDate(d.getDate() - 1);
905
+
906
+ const day = d.getDay(); // 0 = Sunday, 6 = Saturday
907
+
908
+ if (day !== 0 && day !== 6) {
909
+ count++;
910
+ }
911
+ }
912
+
913
+ return d.toISOString().split('T')[0];
914
+ };
915
+
898
916
  switch (op) {
899
917
  // ============================================
900
918
  // BASIC COMPARISONS
@@ -1070,30 +1088,14 @@ export class FilterService {
1070
1088
 
1071
1089
  case 'is_before_business_days': {
1072
1090
  if (isNaN(numVal)) {
1073
- throw new BadRequestException(
1074
- 'Value must be a number for is_before_business_days',
1075
- );
1091
+ throw new BadRequestException('Value must be a number');
1076
1092
  }
1077
1093
 
1078
- const businessBefore = (() => {
1079
- let d = new Date();
1080
- let count = 0;
1081
-
1082
- while (count < numVal) {
1083
- d.setDate(d.getDate() - 1);
1084
- const day = d.getDay(); // 0=Sun, 6=Sat
1085
- if (day !== 0 && day !== 6) count++;
1086
- }
1087
-
1088
- // DB shift -1 day
1089
- d.setDate(d.getDate() - 1);
1090
-
1091
- return d.toISOString().split('T')[0];
1092
- })();
1094
+ const targetDate = subtractBusinessDays(numVal);
1093
1095
 
1094
1096
  return {
1095
1097
  query: `${dateColumn} < :${key}`,
1096
- params: { [key]: businessBefore },
1098
+ params: { [key]: targetDate },
1097
1099
  };
1098
1100
  }
1099
1101
 
@@ -57,15 +57,15 @@ export class ActionCategoryRepository {
57
57
  async actionscategoryinfo(entity_type: string) {
58
58
  const result = await this.actionCategoryRepository
59
59
  .createQueryBuilder('ac')
60
- .select(['ac.id', 'ac.name', 'ac.logo', 'ac.modalName'])
60
+ .select('ac.*')
61
61
  .where('ac.mapped_entity_type = :entityType', { entityType: entity_type })
62
62
  .getRawMany();
63
63
 
64
64
  const mapped = result.map((row) => ({
65
- label: row.ac_name,
66
- logo: row.ac_logo,
67
- modalName: row.ac_modalName,
68
- value: String(row.ac_id),
65
+ label: row.name,
66
+ logo: row.logo,
67
+ modalname: row.modalname,
68
+ value: String(row.id),
69
69
  }));
70
70
 
71
71
  return mapped.reduce(
@@ -224,12 +224,13 @@ export class ActionRepository {
224
224
  ) {
225
225
  // Step 1: Get all action mappings for the stage
226
226
 
227
- const stageActionMappingRepo = this.reflectionHelper.getRepoService('StageActionMapping');
227
+ const stageActionMappingRepo =
228
+ this.reflectionHelper.getRepoService('StageActionMapping');
228
229
  const stageActions = await stageActionMappingRepo.find({
229
230
  where: {
230
- stage_id: stage_id
231
- }
232
- })
231
+ stage_id: stage_id,
232
+ },
233
+ });
233
234
 
234
235
  if (!stageActions?.length) {
235
236
  return [
@@ -260,7 +261,11 @@ export class ActionRepository {
260
261
  'a.dependent_action_id AS dependent_action_id',
261
262
  ])
262
263
  .from('frm_wf_action', 'a')
263
- .leftJoin('frm_wf_action_category', 'ac', 'ac.id::text = a.action_category')
264
+ .leftJoin(
265
+ 'frm_wf_action_category',
266
+ 'ac',
267
+ 'ac.id::text = a.action_category',
268
+ )
264
269
  .where('a.organization_id = :orgId', { orgId: organization_id })
265
270
  .andWhere('a.id IN (:...actionIds)', { actionIds })
266
271
  .getRawMany();