rez_core 5.0.249 → 5.0.251
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 +27 -26
- package/dist/module/filter/service/filter.service.js.map +1 -1
- package/dist/module/meta/service/media-data.service.js +1 -1
- package/dist/module/meta/service/media-data.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/filter/service/filter.service.ts +46 -36
- package/src/module/meta/service/media-data.service.ts +1 -2
package/package.json
CHANGED
|
@@ -934,18 +934,32 @@ export class FilterService {
|
|
|
934
934
|
const numVal = Number(val);
|
|
935
935
|
|
|
936
936
|
// INSIDE buildDateCondition
|
|
937
|
-
const subtractBusinessDays = (days: number): string => {
|
|
938
|
-
|
|
939
|
-
|
|
937
|
+
// const subtractBusinessDays = (days: number): string => {
|
|
938
|
+
// let d = new Date();
|
|
939
|
+
// let count = 0;
|
|
940
940
|
|
|
941
|
-
|
|
942
|
-
|
|
941
|
+
// while (count < days) {
|
|
942
|
+
// d.setDate(d.getDate() - 1);
|
|
943
943
|
|
|
944
|
-
|
|
944
|
+
// const day = d.getDay(); // 0 = Sunday, 6 = Saturday
|
|
945
945
|
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
946
|
+
// if (day !== 0 && day !== 6) {
|
|
947
|
+
// count++;
|
|
948
|
+
// }
|
|
949
|
+
// }
|
|
950
|
+
|
|
951
|
+
// return d.toISOString().split('T')[0];
|
|
952
|
+
// };
|
|
953
|
+
|
|
954
|
+
const moveBusinessDays = (offset: number): string => {
|
|
955
|
+
let d = new Date();
|
|
956
|
+
const abs = Math.abs(offset);
|
|
957
|
+
let count = 0;
|
|
958
|
+
|
|
959
|
+
while (count < abs) {
|
|
960
|
+
d.setDate(d.getDate() + (offset > 0 ? 1 : -1)); // forward for +ve / backward for -ve
|
|
961
|
+
const day = d.getDay(); // 0=Sun, 6=Sat
|
|
962
|
+
if (day !== 0 && day !== 6) count++; // skip weekends
|
|
949
963
|
}
|
|
950
964
|
|
|
951
965
|
return d.toISOString().split('T')[0];
|
|
@@ -1006,7 +1020,7 @@ export class FilterService {
|
|
|
1006
1020
|
// ============================================
|
|
1007
1021
|
// DAY OFFSET LOGIC (ALWAYS ADJUST -1 DAY)
|
|
1008
1022
|
// ============================================
|
|
1009
|
-
case 'is_day_before':
|
|
1023
|
+
case 'is_day_before': {
|
|
1010
1024
|
if (isNaN(numVal)) {
|
|
1011
1025
|
throw new BadRequestException(
|
|
1012
1026
|
'Value must be a number for is_day_before',
|
|
@@ -1015,18 +1029,23 @@ export class FilterService {
|
|
|
1015
1029
|
|
|
1016
1030
|
const dayBefore = (() => {
|
|
1017
1031
|
const d = new Date();
|
|
1018
|
-
d.setDate(d.getDate() - numVal);
|
|
1019
1032
|
|
|
1020
|
-
|
|
1021
|
-
|
|
1033
|
+
if (numVal >= 0) {
|
|
1034
|
+
d.setDate(d.getDate() + numVal);
|
|
1035
|
+
} else {
|
|
1036
|
+
d.setDate(d.getDate() - Math.abs(numVal));
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
return d.toISOString().split('T')[0];
|
|
1022
1040
|
})();
|
|
1023
1041
|
|
|
1024
1042
|
return {
|
|
1025
|
-
query: `${dateColumn}
|
|
1043
|
+
query: `${dateColumn} < :${key}`,
|
|
1026
1044
|
params: { [key]: dayBefore },
|
|
1027
1045
|
};
|
|
1046
|
+
}
|
|
1028
1047
|
|
|
1029
|
-
case 'is_day_after':
|
|
1048
|
+
case 'is_day_after': {
|
|
1030
1049
|
if (isNaN(numVal)) {
|
|
1031
1050
|
throw new BadRequestException(
|
|
1032
1051
|
'Value must be a number for is_day_after',
|
|
@@ -1035,7 +1054,13 @@ export class FilterService {
|
|
|
1035
1054
|
|
|
1036
1055
|
const dayAfter = (() => {
|
|
1037
1056
|
const d = new Date();
|
|
1038
|
-
|
|
1057
|
+
|
|
1058
|
+
if (numVal >= 0) {
|
|
1059
|
+
d.setDate(d.getDate() + numVal);
|
|
1060
|
+
} else {
|
|
1061
|
+
d.setDate(d.getDate() - Math.abs(numVal));
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1039
1064
|
return d.toISOString().split('T')[0];
|
|
1040
1065
|
})();
|
|
1041
1066
|
|
|
@@ -1043,6 +1068,7 @@ export class FilterService {
|
|
|
1043
1068
|
query: `${dateColumn} > :${key}`,
|
|
1044
1069
|
params: { [key]: dayAfter },
|
|
1045
1070
|
};
|
|
1071
|
+
}
|
|
1046
1072
|
|
|
1047
1073
|
// ============================================
|
|
1048
1074
|
// MONTH OFFSET LOGIC
|
|
@@ -1131,7 +1157,7 @@ export class FilterService {
|
|
|
1131
1157
|
throw new BadRequestException('Value must be a number');
|
|
1132
1158
|
}
|
|
1133
1159
|
|
|
1134
|
-
const targetDate =
|
|
1160
|
+
const targetDate = moveBusinessDays(numVal);
|
|
1135
1161
|
|
|
1136
1162
|
return {
|
|
1137
1163
|
query: `${dateColumn} <= :${key} AND EXTRACT(DOW FROM ${dateColumn}) NOT IN (0, 6)`,
|
|
@@ -1141,30 +1167,14 @@ export class FilterService {
|
|
|
1141
1167
|
|
|
1142
1168
|
case 'is_after_business_days': {
|
|
1143
1169
|
if (isNaN(numVal)) {
|
|
1144
|
-
throw new BadRequestException(
|
|
1145
|
-
'Value must be a number for is_after_business_days',
|
|
1146
|
-
);
|
|
1170
|
+
throw new BadRequestException('Value must be a number');
|
|
1147
1171
|
}
|
|
1148
1172
|
|
|
1149
|
-
const
|
|
1150
|
-
let d = new Date();
|
|
1151
|
-
let count = 0;
|
|
1152
|
-
|
|
1153
|
-
while (count < numVal) {
|
|
1154
|
-
d.setDate(d.getDate() + 1);
|
|
1155
|
-
const day = d.getDay(); // 0=Sun, 6=Sat
|
|
1156
|
-
if (day !== 0 && day !== 6) count++;
|
|
1157
|
-
}
|
|
1158
|
-
|
|
1159
|
-
// DB shift -1 day
|
|
1160
|
-
d.setDate(d.getDate() - 1);
|
|
1161
|
-
|
|
1162
|
-
return d.toISOString().split('T')[0];
|
|
1163
|
-
})();
|
|
1173
|
+
const targetDate = moveBusinessDays(numVal);
|
|
1164
1174
|
|
|
1165
1175
|
return {
|
|
1166
1176
|
query: `${dateColumn} > :${key}`,
|
|
1167
|
-
params: { [key]:
|
|
1177
|
+
params: { [key]: targetDate },
|
|
1168
1178
|
};
|
|
1169
1179
|
}
|
|
1170
1180
|
|
|
@@ -168,8 +168,7 @@ export class MediaDataService extends EntityServiceImpl {
|
|
|
168
168
|
Bucket: this.bucketName,
|
|
169
169
|
Key: mediaData.media_url,
|
|
170
170
|
Expires: Number(expiresIn) || 60 * 5,
|
|
171
|
-
|
|
172
|
-
ResponseContentDisposition: `attachment; filename="${mediaData.file_name}"`,
|
|
171
|
+
ResponseContentDisposition: 'inline',
|
|
173
172
|
});
|
|
174
173
|
return {
|
|
175
174
|
signedUrl,
|