Skip to content

Commit

Permalink
Cleaning up image field for moduleFeatureHighlights
Browse files Browse the repository at this point in the history
  • Loading branch information
wkhearn committed Feb 14, 2020
1 parent d6374aa commit 90b91f3
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions api/wo/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = (parsed) => {
let links = []
let values = []
let singleRows = []
let highlights = []
let slides = []
let logos = []
let products = []
Expand Down Expand Up @@ -316,6 +317,39 @@ module.exports = (parsed) => {
})
cleanModules.push(cleanModule)
break;
case 'moduleFeatureHighlights':
module.fields.featureHighlights.forEach((highlight) => {
let cleanHighlight = {
fields: {
image: {
fields: {
file: {
url: highlight.fields.image.fields.file.url
}
}
},
video: highlight.fields.video,
title: highlight.fields.title,
description: highlight.fields.description
}
}
highlights.push(cleanHighlight)
})
cleanModule = Object.assign({}, cleanModule, {
sys: {
contentType: {
sys: {
id: 'moduleFeatureHighlights'
}
}
},
fields: {
helpfulTitle: module.fields.helpfulTitle,
featureHighlights: highlights
}
})
cleanModules.push(cleanModule)
break;
case 'moduleSlideshow':
if (module.fields.companyLogo) {
module.fields.companyLogo.forEach((logo) => {
Expand Down

0 comments on commit 90b91f3

Please sign in to comment.