From d9997a3a6a6d11259f5e116040d3c57f3d213ffe Mon Sep 17 00:00:00 2001 From: George Goodall Date: Wed, 9 Oct 2024 09:50:44 +0100 Subject: [PATCH] update resource in params to resource not in params --- src/middleware/common.middleware.js | 2 +- src/middleware/datasetOverview.middleware.js | 4 ++-- src/middleware/issueDetails.middleware.js | 4 ++-- src/middleware/issueTable.middleware.js | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/middleware/common.middleware.js b/src/middleware/common.middleware.js index a9f680f5..c77b5a3b 100644 --- a/src/middleware/common.middleware.js +++ b/src/middleware/common.middleware.js @@ -41,7 +41,7 @@ export const fetchDatasetInfo = fetchOne({ */ export const isResourceAccessible = (req) => req.resourceStatus.status === '200' export const isResourceNotAccessible = (req) => !isResourceAccessible(req) -export const isResourceIdInParams = ({ params }) => !('resourceId' in params) +export const isResourceIdNotInParams = ({ params }) => !('resourceId' in params) /** * Middleware. Updates req with `resource`. diff --git a/src/middleware/datasetOverview.middleware.js b/src/middleware/datasetOverview.middleware.js index cff08269..0e9611a0 100644 --- a/src/middleware/datasetOverview.middleware.js +++ b/src/middleware/datasetOverview.middleware.js @@ -1,4 +1,4 @@ -import { fetchDatasetInfo, fetchEntityCount, fetchLatestResource, fetchLpaDatasetIssues, fetchOrgInfo, fetchSpecification, isResourceAccessible, isResourceIdInParams, logPageError, pullOutDatasetSpecification, takeResourceIdFromParams } from './common.middleware.js' +import { fetchDatasetInfo, fetchEntityCount, fetchLatestResource, fetchLpaDatasetIssues, fetchOrgInfo, fetchSpecification, isResourceAccessible, isResourceIdNotInParams, logPageError, pullOutDatasetSpecification, takeResourceIdFromParams } from './common.middleware.js' import { fetchIf, fetchMany, parallel, renderTemplate, FetchOptions } from './middleware.builders.js' import { fetchResourceStatus } from './datasetTaskList.middleware.js' @@ -96,7 +96,7 @@ export default [ parallel([ fetchColumnSummary, fetchResourceStatus, - fetchIf(isResourceIdInParams, fetchLatestResource, takeResourceIdFromParams) + fetchIf(isResourceIdNotInParams, fetchLatestResource, takeResourceIdFromParams) ]), fetchIf(isResourceAccessible, fetchLpaDatasetIssues), fetchSpecification, diff --git a/src/middleware/issueDetails.middleware.js b/src/middleware/issueDetails.middleware.js index 327378f0..8c1dbc25 100644 --- a/src/middleware/issueDetails.middleware.js +++ b/src/middleware/issueDetails.middleware.js @@ -1,5 +1,5 @@ import performanceDbApi from '../services/performanceDbApi.js' -import { fetchDatasetInfo, fetchEntityCount, fetchIssueEntitiesCount, fetchIssues, fetchLatestResource, fetchOrgInfo, formatErrorSummaryParams, isResourceIdInParams, logPageError, reformatIssuesToBeByEntryNumber, takeResourceIdFromParams, validateQueryParams } from './common.middleware.js' +import { fetchDatasetInfo, fetchEntityCount, fetchIssueEntitiesCount, fetchIssues, fetchLatestResource, fetchOrgInfo, formatErrorSummaryParams, isResourceIdNotInParams, logPageError, reformatIssuesToBeByEntryNumber, takeResourceIdFromParams, validateQueryParams } from './common.middleware.js' import { fetchIf, parallel, renderTemplate } from './middleware.builders.js' import * as v from 'valibot' import { pagination } from '../utils/pagination.js' @@ -201,7 +201,7 @@ export default [ validateIssueDetailsQueryParams, fetchOrgInfo, fetchDatasetInfo, - fetchIf(isResourceIdInParams, fetchLatestResource, takeResourceIdFromParams), + fetchIf(isResourceIdNotInParams, fetchLatestResource, takeResourceIdFromParams), fetchIssues, reformatIssuesToBeByEntryNumber, parallel([ diff --git a/src/middleware/issueTable.middleware.js b/src/middleware/issueTable.middleware.js index e2c5554a..527c0ce0 100644 --- a/src/middleware/issueTable.middleware.js +++ b/src/middleware/issueTable.middleware.js @@ -1,7 +1,7 @@ import performanceDbApi from '../services/performanceDbApi.js' import logger from '../utils/logger.js' import { pagination } from '../utils/pagination.js' -import { fetchDatasetInfo, fetchEntityCount, fetchIssueEntitiesCount, fetchIssues, fetchLatestResource, fetchOrgInfo, fetchSpecification, formatErrorSummaryParams, isResourceIdInParams, logPageError, pullOutDatasetSpecification, reformatIssuesToBeByEntryNumber, takeResourceIdFromParams, validateQueryParams } from './common.middleware.js' +import { fetchDatasetInfo, fetchEntityCount, fetchIssueEntitiesCount, fetchIssues, fetchLatestResource, fetchOrgInfo, fetchSpecification, formatErrorSummaryParams, isResourceIdNotInParams, logPageError, pullOutDatasetSpecification, reformatIssuesToBeByEntryNumber, takeResourceIdFromParams, validateQueryParams } from './common.middleware.js' import { fetchIf, fetchMany, FetchOptions, parallel, renderTemplate } from './middleware.builders.js' import * as v from 'valibot' @@ -154,7 +154,7 @@ export default [ fetchOrgInfo, fetchDatasetInfo ]), - fetchIf(isResourceIdInParams, fetchLatestResource, takeResourceIdFromParams), + fetchIf(isResourceIdNotInParams, fetchLatestResource, takeResourceIdFromParams), fetchEntitiesWithIssues, fetchIssueEntitiesCount, fetchSpecification,