Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const createNewPlanningFromNewsItem = (addNewsItemToPlanning, newsCoverageStatus, desk, user, contentTypes) => {
const newCoverage = self.createCoverageFromNewsItem(addNewsItemToPlanning, newsCoverageStatus,
desk, user, contentTypes);
let newPlanning = {
type: ITEM_TYPE.PLANNING,
slugline: addNewsItemToPlanning.slugline,
headline: get(addNewsItemToPlanning, 'headline'),
planning_date: moment(),
ednote: get(addNewsItemToPlanning, 'ednote'),
subject: get(addNewsItemToPlanning, 'subject'),
anpa_category: get(addNewsItemToPlanning, 'anpa_category'),
urgency: get(addNewsItemToPlanning, 'urgency'),
description_text: stripHtmlRaw(get(addNewsItemToPlanning, 'abstract', '')),
coverages: [newCoverage],
};
if (get(addNewsItemToPlanning, 'flags.marked_for_not_publication')) {
newPlanning.flags = {marked_for_not_publication: true};
}
if (get(addNewsItemToPlanning, 'place.length', 0) > 0) {
newPlanning.place = addNewsItemToPlanning.place;
}
return newPlanning;
};