Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
timeToArchive: get(payload, 'meta.post_to_cmr_duration', 0) / 1000,
processingStartDateTime: extractDate(payload, 'meta.sync_granule_end_time'),
processingEndDateTime: extractDate(payload, 'meta.post_to_cmr_start_time')
};
doc.published = get(g, 'published', false);
// Duration is also used as timeToXfer for the EMS report
doc.duration = (doc.timestamp - doc.createdAt) / 1000;
if (g.cmrLink) {
const metadata = await cmrjs.getMetadata(g.cmrLink);
doc.beginningDateTime = metadata.time_start;
doc.endingDateTime = metadata.time_end;
doc.lastUpdateDateTime = metadata.updated;
const fullMetadata = await cmrjs.getFullMetadata(g.cmrLink);
if (fullMetadata && fullMetadata.DataGranule) {
doc.productionDateTime = fullMetadata.DataGranule.ProductionDateTime;
}
}
return this.create(doc);
}
return Promise.resolve();
});