Newer
Older
class Fragment {
constructor({ fragment }) {
this.fragment = fragment
}
async getFragmentData({ handlingEditor = {} }) {
const { fragment: { metadata, recommendations = [], id } } = this
const heRecommendation = recommendations.find(
rec => rec.userId === handlingEditor.id,
)
let { title, abstract } = metadata
const { type } = metadata
title = title.replace(/<(.|\n)*?>/g, '')
abstract = abstract ? abstract.replace(/<(.|\n)*?>/g, '') : ''
return {
id,
type,
title,
abstract,
recommendations,
heRecommendation,
}
}
}
module.exports = Fragment