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/esm/index.js CHANGED
@@ -3763,10 +3763,21 @@ const LogReviewer = (props) => {
3763
3763
  // Destructure
3764
3764
  const { year, month } = toLoad[i];
3765
3765
  // Load
3766
- const logs = yield visitServerEndpoint({
3767
- path: `${LOG_REVIEW_ROUTE_PATH_PREFIX}/years/${year}/months/${month}`,
3768
- method: 'GET',
3769
- });
3766
+ let logs = [];
3767
+ let pageNumber = 1;
3768
+ let hasAnotherPage = true;
3769
+ while (hasAnotherPage) {
3770
+ const response = yield visitServerEndpoint({
3771
+ path: `${LOG_REVIEW_ROUTE_PATH_PREFIX}/years/${year}/months/${month}`,
3772
+ method: 'GET',
3773
+ params: {
3774
+ pageNumber,
3775
+ },
3776
+ });
3777
+ logs = logs.concat(response.items);
3778
+ hasAnotherPage = response.hasAnotherPage;
3779
+ pageNumber += 1;
3780
+ }
3770
3781
  // Add to map
3771
3782
  if (!logMap[year]) {
3772
3783
  logMap[year] = {};
@@ -14026,22 +14037,27 @@ const initServer = (opts) => {
14026
14037
  paramTypes: {
14027
14038
  year: ParamType$1.Int,
14028
14039
  month: ParamType$1.Int,
14040
+ pageNumber: ParamType$1.Int,
14029
14041
  },
14030
14042
  handler: ({ params }) => __awaiter(void 0, void 0, void 0, function* () {
14031
14043
  // Get user info
14032
- const { year, month, userId, isAdmin, } = params;
14044
+ const { year, month, pageNumber, userId, isAdmin, } = params;
14033
14045
  // Validate user
14034
14046
  const canReview = yield canReviewLogs(userId, isAdmin);
14035
14047
  if (!canReview) {
14036
14048
  throw new ErrorWithCode('You cannot access this resource because you do not have the appropriate permissions.', ReactKitErrorCode$1.NotAllowedToReviewLogs);
14037
14049
  }
14038
14050
  // Query for logs
14039
- const logs = yield _logCollection.find({
14040
- year,
14041
- month,
14051
+ const response = yield _logCollection.findPaged({
14052
+ query: {
14053
+ year,
14054
+ month,
14055
+ },
14056
+ perPage: 1000,
14057
+ pageNumber,
14042
14058
  });
14043
- // Return logs
14044
- return logs;
14059
+ // Return response
14060
+ return response;
14045
14061
  }),
14046
14062
  }));
14047
14063
  };