Files
talk/plugins/coral-plugin-respect/index.js
T
2017-03-30 16:28:06 -06:00

35 lines
718 B
JavaScript

const typeDefs = require('./server/typeDefs');
module.exports = {
typeDefs,
resolvers: {
RootMutation: {
createRespect(_, {respect: {item_id, item_type}}, {mutators: {Action}}) {
return Action.create({item_id, item_type, action_type: 'RESPECT'});
}
}
},
hooks: {
Action: {
__resolveType: {
post({action_type}) {
switch (action_type) {
case 'RESPECT':
return 'RespectAction';
}
}
}
},
ActionSummary: {
__resolveType: {
post({action_type}) {
switch (action_type) {
case 'RESPECT':
return 'RespectActionSummary';
}
}
}
}
}
};