mirror of
https://github.com/wassname/talk.git
synced 2026-07-02 22:14:11 +08:00
17 lines
319 B
JavaScript
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
|
|
};
|