forest-express
Version:
Official package for all Forest Express Lianas
27 lines (26 loc) • 877 B
JavaScript
;
var JSONAPISerializer = require('jsonapi-serializer').Serializer;
function serializeCloseioLeads(attributes, collectionName, meta) {
var type = "".concat(collectionName, "_closeio_leads");
return new JSONAPISerializer(type, attributes, {
attributes: ['url', 'created_by_name', 'display_name', 'status_label', 'date_created', 'date_updated', 'description', 'emails'],
emails: {
ref: 'id',
included: false,
ignoreRelationshipData: true,
nullIfMissing: true,
relationshipLinks: {
related: function related(dataSet) {
return {
href: "/forest/".concat(collectionName, "_closeio_leads/").concat(dataSet.id, "/emails")
};
}
}
},
keyForAttribute: function keyForAttribute(key) {
return key;
},
meta: meta
});
}
module.exports = serializeCloseioLeads;