Files
talk/graph/resolvers/action.js
T
2017-05-03 13:31:57 -06:00

21 lines
514 B
JavaScript

const Action = {
__resolveType({action_type}) {
switch (action_type) {
case 'DONTAGREE':
return 'DontAgreeAction';
case 'FLAG':
return 'FlagAction';
}
},
// This will load the user for the specific action. We'll limit this to the
// admin users only or the current logged in user.
user({user_id}, _, {loaders: {Users}, user}) {
if (user && (user.hasRole('ADMIN') || user_id === user.id)) {
return Users.getByID.load(user_id);
}
}
};
module.exports = Action;