dce-reactkit 3.9.3 → 3.9.4-beta-logreviewer.1
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/cjs/index.js +26 -10
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +26 -10
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/LogReviewer.tsx +17 -4
- package/src/server/initServer.ts +11 -5
package/dist/cjs/index.js
CHANGED
|
@@ -3791,10 +3791,21 @@ const LogReviewer = (props) => {
|
|
|
3791
3791
|
// Destructure
|
|
3792
3792
|
const { year, month } = toLoad[i];
|
|
3793
3793
|
// Load
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3794
|
+
let logs = [];
|
|
3795
|
+
let pageNumber = 1;
|
|
3796
|
+
let hasAnotherPage = true;
|
|
3797
|
+
while (hasAnotherPage) {
|
|
3798
|
+
const response = yield visitServerEndpoint({
|
|
3799
|
+
path: `${LOG_REVIEW_ROUTE_PATH_PREFIX}/years/${year}/months/${month}`,
|
|
3800
|
+
method: 'GET',
|
|
3801
|
+
params: {
|
|
3802
|
+
pageNumber,
|
|
3803
|
+
},
|
|
3804
|
+
});
|
|
3805
|
+
logs = logs.concat(response.items);
|
|
3806
|
+
hasAnotherPage = response.hasAnotherPage;
|
|
3807
|
+
pageNumber += 1;
|
|
3808
|
+
}
|
|
3798
3809
|
// Add to map
|
|
3799
3810
|
if (!logMap[year]) {
|
|
3800
3811
|
logMap[year] = {};
|
|
@@ -14054,22 +14065,27 @@ const initServer = (opts) => {
|
|
|
14054
14065
|
paramTypes: {
|
|
14055
14066
|
year: ParamType$1.Int,
|
|
14056
14067
|
month: ParamType$1.Int,
|
|
14068
|
+
pageNumber: ParamType$1.Int,
|
|
14057
14069
|
},
|
|
14058
14070
|
handler: ({ params }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14059
14071
|
// Get user info
|
|
14060
|
-
const { year, month, userId, isAdmin, } = params;
|
|
14072
|
+
const { year, month, pageNumber, userId, isAdmin, } = params;
|
|
14061
14073
|
// Validate user
|
|
14062
14074
|
const canReview = yield canReviewLogs(userId, isAdmin);
|
|
14063
14075
|
if (!canReview) {
|
|
14064
14076
|
throw new ErrorWithCode('You cannot access this resource because you do not have the appropriate permissions.', ReactKitErrorCode$1.NotAllowedToReviewLogs);
|
|
14065
14077
|
}
|
|
14066
14078
|
// Query for logs
|
|
14067
|
-
const
|
|
14068
|
-
|
|
14069
|
-
|
|
14079
|
+
const response = yield _logCollection.findPaged({
|
|
14080
|
+
query: {
|
|
14081
|
+
year,
|
|
14082
|
+
month,
|
|
14083
|
+
},
|
|
14084
|
+
perPage: 1000,
|
|
14085
|
+
pageNumber,
|
|
14070
14086
|
});
|
|
14071
|
-
// Return
|
|
14072
|
-
return
|
|
14087
|
+
// Return response
|
|
14088
|
+
return response;
|
|
14073
14089
|
}),
|
|
14074
14090
|
}));
|
|
14075
14091
|
};
|