Feat: News in the client app (#34392)
This commit is contained in:
26
client/plugins/fcc-source-news/create-news-node.js
Normal file
26
client/plugins/fcc-source-news/create-news-node.js
Normal file
@@ -0,0 +1,26 @@
|
||||
const crypto = require('crypto');
|
||||
|
||||
function createNewsNode(article) {
|
||||
const contentDigest = crypto
|
||||
.createHash('md5')
|
||||
.update(JSON.stringify(article))
|
||||
.digest('hex');
|
||||
|
||||
const internal = {
|
||||
contentDigest,
|
||||
type: 'NewsArticleNode'
|
||||
};
|
||||
|
||||
return JSON.parse(
|
||||
JSON.stringify({
|
||||
...article,
|
||||
id: article._id + ' >>>>>>> ' + internal.type,
|
||||
children: [],
|
||||
parent: null,
|
||||
internal,
|
||||
sourceInstanceName: 'article'
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
exports.createNewsNode = createNewsNode;
|
Reference in New Issue
Block a user