rez_core 5.0.73 → 5.0.74
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/filter/service/filter.service.js +18 -7
- package/dist/module/filter/service/filter.service.js.map +1 -1
- package/dist/module/integration/service/wrapper.service.js +1 -1
- package/dist/module/integration/service/wrapper.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/src/module/filter/service/filter.service.ts +24 -44
- package/src/module/integration/service/wrapper.service.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rez_core",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.74",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "",
|
|
6
6
|
"private": false,
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"cron-parser": "^5.4.0",
|
|
48
48
|
"crypto": "^1.0.1",
|
|
49
49
|
"crypto-js": "^4.2.0",
|
|
50
|
+
"dayjs": "^1.11.19",
|
|
50
51
|
"dotenv": "^16.4.7",
|
|
51
52
|
"exceljs": "^4.4.0",
|
|
52
53
|
"firebase-admin": "^13.5.0",
|
|
@@ -10,6 +10,7 @@ import { EntityRelationService } from 'src/module/meta/service/entity-relation.s
|
|
|
10
10
|
import { ResolverService } from 'src/module/meta/service/resolver.service';
|
|
11
11
|
import { LoggingService } from 'src/utils/service/loggingUtil.service';
|
|
12
12
|
import { ConfigService } from '@nestjs/config';
|
|
13
|
+
import dayjs from 'dayjs';
|
|
13
14
|
|
|
14
15
|
@Injectable()
|
|
15
16
|
export class FilterService {
|
|
@@ -1110,61 +1111,40 @@ export class FilterService {
|
|
|
1110
1111
|
// ============================================
|
|
1111
1112
|
|
|
1112
1113
|
case 'is_before_business_days': {
|
|
1113
|
-
|
|
1114
|
-
|
|
1114
|
+
if (isNaN(numVal)) {
|
|
1115
|
+
throw new BadRequestException('Value must be a number');
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
const targetDate = subtractBusinessDays(numVal);
|
|
1115
1119
|
|
|
1116
|
-
// SQL: only match dates that are business days
|
|
1117
1120
|
return {
|
|
1118
|
-
query:
|
|
1119
|
-
params: { [key]:
|
|
1121
|
+
query: `${dateColumn} < :${key} AND EXTRACT(DOW FROM ${dateColumn}) NOT IN (0, 6)`,
|
|
1122
|
+
params: { [key]: targetDate },
|
|
1120
1123
|
};
|
|
1121
1124
|
}
|
|
1122
1125
|
|
|
1123
1126
|
case 'is_after_business_days': {
|
|
1124
1127
|
const days = Number(val);
|
|
1125
|
-
const target = moveBusinessDays(new Date(), days, +1); // go forward
|
|
1126
|
-
|
|
1127
|
-
return {
|
|
1128
|
-
query: `e.${attr} = :${key} AND EXTRACT(DOW FROM e.${attr}) NOT IN (0, 6)`,
|
|
1129
|
-
params: { [key]: target.toISOString().split('T')[0] },
|
|
1130
|
-
};
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
// case 'is_before_business_days': {
|
|
1134
|
-
// if (isNaN(numVal)) {
|
|
1135
|
-
// throw new BadRequestException('Value must be a number');
|
|
1136
|
-
// }
|
|
1137
|
-
|
|
1138
|
-
// const targetDate = subtractBusinessDays(numVal);
|
|
1139
|
-
|
|
1140
|
-
// return {
|
|
1141
|
-
// query: `${dateColumn} < :${key} AND EXTRACT(DOW FROM ${dateColumn}) NOT IN (0, 6)`,
|
|
1142
|
-
// params: { [key]: targetDate },
|
|
1143
|
-
// };
|
|
1144
|
-
// }
|
|
1145
1128
|
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
// // Start from today
|
|
1150
|
-
// const targetDate = dayjs().startOf('day');
|
|
1151
|
-
// let count = 0;
|
|
1129
|
+
// Start from today
|
|
1130
|
+
const targetDate = dayjs().startOf('day');
|
|
1131
|
+
let count = 0;
|
|
1152
1132
|
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1133
|
+
while (count < days) {
|
|
1134
|
+
targetDate.add(1, 'day'); // move forward
|
|
1135
|
+
const day = targetDate.day(); // 0 = Sun, 6 = Sat
|
|
1156
1136
|
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1137
|
+
if (day !== 0 && day !== 6) {
|
|
1138
|
+
// skip weekends
|
|
1139
|
+
count++;
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1162
1142
|
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1143
|
+
return {
|
|
1144
|
+
query: `DATE(e.${attr}) > :${key}`,
|
|
1145
|
+
params: { [key]: targetDate.format('YYYY-MM-DD') },
|
|
1146
|
+
};
|
|
1147
|
+
}
|
|
1168
1148
|
|
|
1169
1149
|
// case 'is_before_business_days': {
|
|
1170
1150
|
// if (isNaN(numVal)) {
|
|
@@ -420,7 +420,7 @@ export class WrapperService {
|
|
|
420
420
|
content: base64Content,
|
|
421
421
|
type:
|
|
422
422
|
response.headers['content-type'] || 'application/octet-stream',
|
|
423
|
-
filename:
|
|
423
|
+
filename: url.fileName,
|
|
424
424
|
disposition: 'attachment',
|
|
425
425
|
});
|
|
426
426
|
}
|