Make debug email routes work with new APIs

This commit is contained in:
SachaG 2018-06-06 11:39:04 +09:00
parent a532dab9b7
commit ad1f47ef73
3 changed files with 6 additions and 13 deletions

View file

@ -79,7 +79,7 @@ export const getDefaultResolvers = (collectionName, resolverOptions = defaultOpt
description: `A single ${typeName} document fetched by ID or slug`,
async resolver(root, { input = {} }, context, { cacheControl }) {
const { selector, enableCache = false } = input;
const { selector = {}, enableCache = false } = input;
const { documentId, slug } = selector;
debug('');

View file

@ -21,8 +21,11 @@ Meteor.startup(function () {
// else get test object (sample post, comment, user, etc.)
const testVariables = (typeof email.testVariables === 'function' ? email.testVariables() : email.testVariables) || {};
// delete params.query so we don't pass it to GraphQL query
delete params.query;
// merge test variables with params from URL
const variables = {...testVariables, ...params};
// TODO: this is currently hardcoded to work with the SingleXYZInput type, maybe bad idea?
const variables = { input: { selector: { ...testVariables, ...params } } };
const result = email.query ? await runQuery(email.query, variables, { locale }) : {data: {}};

View file

@ -72,17 +72,7 @@ const resolvers = {
},
},
// total: {
// name: 'UsersTotal',
// async resolver(root, { terms = {} }, { Users }) {
// const {selector} = await Users.getParameters(terms);
// return await Connectors.count(Users, selector);
// },
// }
};
export default resolvers;