Skip to content

Commit

Permalink
CMS-421: Add filter that removes draft state activities and facilitie…
Browse files Browse the repository at this point in the history
…s to park search api (#1483)
  • Loading branch information
ayumi-oxd authored Oct 9, 2024
1 parent a599f5a commit 3af51ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,23 @@ module.exports = ({ strapi }) => ({
populate: { "parkNameType": { fields: ["nameTypeId"] } }
},
parkFacilities: {
fields: ["isFacilityOpen", "isActive"],
fields: ["isFacilityOpen", "isActive", "publishedAt"],
populate: {
"facilityType": {
fields: ["facilityCode", "isActive", "facilityNumber"]
}
}
},
parkActivities: {
fields: ["isActivityOpen", "isActive"],
fields: ["isActivityOpen", "isActive", "publishedAt"],
populate: {
"activityType": {
fields: ["activityCode", "isActive", "activityNumber"]
}
}
},
parkCampingTypes: {
fields: ["isCampingOpen", "isActive"],
fields: ["isCampingOpen", "isActive", "publishedAt"],
populate: {
"campingType": {
fields: ["campingTypeCode", "isActive", "campingTypeNumber"]
Expand Down
6 changes: 3 additions & 3 deletions src/scheduler/elasticsearch/transformers/park/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ exports.createElasticPark = async function (park, photos) {
if (park?.parkCampingTypes?.length) {
const parkCampingTypes = park.parkCampingTypes
.filter(ct => {
return ct.isActive && ct.campingType?.isActive;
return ct.isActive && ct.campingType?.isActive && ct.publishedAt !== null;
})
.map(ct => {
park.hasCamping = true;
Expand All @@ -86,7 +86,7 @@ exports.createElasticPark = async function (park, photos) {
if (park?.parkFacilities?.length) {
park.parkFacilities = park.parkFacilities
.filter(f => {
return f.isActive && f.facilityType?.isActive;
return f.isActive && f.facilityType?.isActive && f.publishedAt !== null;
})
.map(f => {
return {
Expand All @@ -100,7 +100,7 @@ exports.createElasticPark = async function (park, photos) {
if (park?.parkActivities?.length) {
park.parkActivities = park.parkActivities
.filter(a => {
return a.isActive && a.activityType?.isActive;
return a.isActive && a.activityType?.isActive && a.publishedAt !== null;
})
.map(a => {
return {
Expand Down

0 comments on commit 3af51ec

Please sign in to comment.