Skip to content

Commit

Permalink
update resource in params to resource not in params
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeGoodall committed Oct 9, 2024
1 parent 330ab00 commit d9997a3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/middleware/common.middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
4 changes: 2 additions & 2 deletions src/middleware/datasetOverview.middleware.js
Original file line number Diff line number Diff line change
@@ -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'

Expand Down Expand Up @@ -96,7 +96,7 @@ export default [
parallel([
fetchColumnSummary,
fetchResourceStatus,
fetchIf(isResourceIdInParams, fetchLatestResource, takeResourceIdFromParams)
fetchIf(isResourceIdNotInParams, fetchLatestResource, takeResourceIdFromParams)
]),
fetchIf(isResourceAccessible, fetchLpaDatasetIssues),
fetchSpecification,
Expand Down
4 changes: 2 additions & 2 deletions src/middleware/issueDetails.middleware.js
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -201,7 +201,7 @@ export default [
validateIssueDetailsQueryParams,
fetchOrgInfo,
fetchDatasetInfo,
fetchIf(isResourceIdInParams, fetchLatestResource, takeResourceIdFromParams),
fetchIf(isResourceIdNotInParams, fetchLatestResource, takeResourceIdFromParams),
fetchIssues,
reformatIssuesToBeByEntryNumber,
parallel([
Expand Down
4 changes: 2 additions & 2 deletions src/middleware/issueTable.middleware.js
Original file line number Diff line number Diff line change
@@ -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'

Expand Down Expand Up @@ -154,7 +154,7 @@ export default [
fetchOrgInfo,
fetchDatasetInfo
]),
fetchIf(isResourceIdInParams, fetchLatestResource, takeResourceIdFromParams),
fetchIf(isResourceIdNotInParams, fetchLatestResource, takeResourceIdFromParams),
fetchEntitiesWithIssues,
fetchIssueEntitiesCount,
fetchSpecification,
Expand Down

0 comments on commit d9997a3

Please sign in to comment.