blixify-server 0.3.27 → 0.3.28
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/apis/mongoWrapper.js +12 -12
- package/package.json +1 -1
|
@@ -824,7 +824,7 @@ class MongoWrapper {
|
|
|
824
824
|
}
|
|
825
825
|
});
|
|
826
826
|
this.initList = (req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
827
|
-
var _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9;
|
|
827
|
+
var _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10;
|
|
828
828
|
try {
|
|
829
829
|
//INFO : Security Checker
|
|
830
830
|
const validBaseConfig = (0, QueryModel_1.checkBaseConfig)(this.config, req);
|
|
@@ -846,7 +846,7 @@ class MongoWrapper {
|
|
|
846
846
|
}
|
|
847
847
|
const sort = (_v = req.body.sort) !== null && _v !== void 0 ? _v : { date: -1 };
|
|
848
848
|
const limit = (_w = req.body.limit) !== null && _w !== void 0 ? _w : 50;
|
|
849
|
-
const skip = (_x = req.body.
|
|
849
|
+
const skip = (_y = (_x = req.body.cursor) !== null && _x !== void 0 ? _x : req.body.skip) !== null && _y !== void 0 ? _y : 0;
|
|
850
850
|
const pipeline = [];
|
|
851
851
|
// Build unionWith pipeline
|
|
852
852
|
unionCollections.forEach((collectionConfig, index) => {
|
|
@@ -943,7 +943,7 @@ class MongoWrapper {
|
|
|
943
943
|
const countResult = yield mongoCollection
|
|
944
944
|
.aggregate(countPipeline)
|
|
945
945
|
.toArray();
|
|
946
|
-
const count = ((
|
|
946
|
+
const count = ((_z = countResult[0]) === null || _z === void 0 ? void 0 : _z.total) || 0;
|
|
947
947
|
let validOpsConfig = true;
|
|
948
948
|
dataList.map((eachData) => {
|
|
949
949
|
if (!(0, QueryModel_1.checkOpsConfig)(this.config, "read", req, eachData)) {
|
|
@@ -958,17 +958,17 @@ class MongoWrapper {
|
|
|
958
958
|
data: dataList,
|
|
959
959
|
count,
|
|
960
960
|
};
|
|
961
|
-
if ((
|
|
961
|
+
if ((_0 = req.body) === null || _0 === void 0 ? void 0 : _0.stopRes)
|
|
962
962
|
return resBody;
|
|
963
963
|
res.send(resBody);
|
|
964
964
|
return;
|
|
965
965
|
}
|
|
966
966
|
if (aggregate) {
|
|
967
967
|
const dataList = [];
|
|
968
|
-
const queryId = (
|
|
969
|
-
const dateId = (
|
|
968
|
+
const queryId = (_1 = aggregate.queryId) !== null && _1 !== void 0 ? _1 : "";
|
|
969
|
+
const dateId = (_2 = aggregate.dateId) !== null && _2 !== void 0 ? _2 : "baseUpdatedAt";
|
|
970
970
|
const timezone = aggregate.timezone || "Asia/Kuala_Lumpur";
|
|
971
|
-
const dateRanges = (
|
|
971
|
+
const dateRanges = (_3 = aggregate.range) !== null && _3 !== void 0 ? _3 : [
|
|
972
972
|
(0, moment_timezone_1.default)().tz(timezone).format("DD/MM/YYYY HH:mm:ss"),
|
|
973
973
|
];
|
|
974
974
|
for (const dateRange of dateRanges) {
|
|
@@ -1111,8 +1111,8 @@ class MongoWrapper {
|
|
|
1111
1111
|
if (aggregate.groupId)
|
|
1112
1112
|
value = result;
|
|
1113
1113
|
else {
|
|
1114
|
-
value = (
|
|
1115
|
-
ids = (
|
|
1114
|
+
value = (_5 = (_4 = result[0]) === null || _4 === void 0 ? void 0 : _4.value) !== null && _5 !== void 0 ? _5 : 0;
|
|
1115
|
+
ids = (_7 = (_6 = result[0]) === null || _6 === void 0 ? void 0 : _6.ids) !== null && _7 !== void 0 ? _7 : [];
|
|
1116
1116
|
}
|
|
1117
1117
|
dataList.push({
|
|
1118
1118
|
_id: id,
|
|
@@ -1123,7 +1123,7 @@ class MongoWrapper {
|
|
|
1123
1123
|
const resBody = {
|
|
1124
1124
|
data: dataList,
|
|
1125
1125
|
};
|
|
1126
|
-
if ((
|
|
1126
|
+
if ((_8 = req.body) === null || _8 === void 0 ? void 0 : _8.stopRes)
|
|
1127
1127
|
return resBody;
|
|
1128
1128
|
res.send(resBody);
|
|
1129
1129
|
}
|
|
@@ -1141,7 +1141,7 @@ class MongoWrapper {
|
|
|
1141
1141
|
mongoCollection.aggregate(pipeline).toArray(),
|
|
1142
1142
|
mongoCollection.aggregate(countPipeline).toArray(),
|
|
1143
1143
|
]);
|
|
1144
|
-
const count = ((
|
|
1144
|
+
const count = ((_9 = countResult[0]) === null || _9 === void 0 ? void 0 : _9.total) || 0;
|
|
1145
1145
|
//INFO : Security Checker
|
|
1146
1146
|
let validOpsConfig = true;
|
|
1147
1147
|
if (dataList.length > 0) {
|
|
@@ -1159,7 +1159,7 @@ class MongoWrapper {
|
|
|
1159
1159
|
data: dataList,
|
|
1160
1160
|
count,
|
|
1161
1161
|
};
|
|
1162
|
-
if ((
|
|
1162
|
+
if ((_10 = req.body) === null || _10 === void 0 ? void 0 : _10.stopRes)
|
|
1163
1163
|
return resBody;
|
|
1164
1164
|
res.send(resBody);
|
|
1165
1165
|
}
|