Files
talk/graph/resolvers/util.js
T
2017-05-11 14:42:06 -06:00

17 lines
319 B
JavaScript

/**
* Decorates the typeResolver with the tags field.
*/
const decorateWithTags = (typeResolver) => {
typeResolver.tags = ({tags = []}, _, {user}) => {
if (user && user.hasRoles('ADMIN')) {
return tags;
}
return tags.filter((tag) => tag.public);
};
};
module.exports = {
decorateWithTags
};