Skip to content

Commit

Permalink
CMS-611: Add parkOperationDates to site
Browse files Browse the repository at this point in the history
  • Loading branch information
ayumi-oxd committed Jan 9, 2025
1 parent dfe46db commit 5a748f1
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
},
"adminNote": {
"type": "text"
},
"site": {
"type": "relation",
"relation": "manyToOne",
"target": "api::site.site",
"inversedBy": "parkOperationDates"
}
}
}
11 changes: 8 additions & 3 deletions src/cms/src/api/site/content-types/site/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
"singularName": "site",
"pluralName": "sites",
"displayName": "Site",
"name": "site"
"name": "site",
"description": ""
},
"options": {
"increments": true,
"timestamps": true,
"draftAndPublish": true
},
"attributes": {
Expand Down Expand Up @@ -142,6 +141,12 @@
"relation": "manyToMany",
"target": "api::trail-report.trail-report",
"mappedBy": "sites"
},
"parkOperationDates": {
"type": "relation",
"relation": "oneToMany",
"target": "api::park-operation-date.park-operation-date",
"mappedBy": "site"
}
}
}
3 changes: 3 additions & 0 deletions src/gatsby/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ module.exports = {
parkOperation: {
fields: "*"
},
parkOperationDates: {
fields: "*"
},
trailReports: {
fields: "*"
}
Expand Down
7 changes: 6 additions & 1 deletion src/gatsby/src/templates/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export default function SiteTemplate({ data }) {
isLoadingProtectedArea={isLoadingProtectedArea}
searchArea={searchArea}
parkOperation={operations}
operationDates={park.parkOperationDates}
operationDates={site?.parkOperationDates || park.parkOperationDates}
subAreas={park.parkOperationSubAreas.filter(sa => sa.orcsSiteNumber === site.orcsSiteNumber)}
/>
</div>
Expand Down Expand Up @@ -620,6 +620,11 @@ export const query = graphql`
reportUrl
reportDate
}
parkOperationDates {
operatingYear
gateOpenDate
gateCloseDate
}
}
featuredPhotos: allStrapiParkPhoto(
filter: {
Expand Down

0 comments on commit 5a748f1

Please sign in to comment.