Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
resolve: ({localTodoId}) => {
var todo = getTodo(localTodoId);
return {
cursor: cursorForObjectInConnection(getTodos(), todo),
node: todo,
};
}
},
resolve: ({orders, order}) => {
var offset = orders[0].forEach((cursor, index) => {
console.log('mutation:orderRestaurantEdge:cursorIds', cursor.id);
if(cursor.id === order.id) return index;
});
console.log('mutation:orderRestaurantEdge', order);
return {
cursor: cursorForObjectInConnection(orders[0], order),
node: order
};
}
},
resolve: draft => {
return {
cursor: cursorForObjectInConnection(getDrafts(), draft),
node: draft
};
}
},
mutateAndGetPayload: async({ id, quantity }, session) => {
logger.info('Invoke addToCartMutation with params:', { id, quantity });
const cart = cartService.getSessionCart(session);
const localProductId = fromGlobalId(id).id;
const product = productService.findById(localProductId);
const cartEntry = cartService.addToCart(cart, product.productCode, quantity);
const cartEntryEdge = {
cursor: cursorForObjectInConnection(cart.entries, cartEntry),
node: cartEntry,
};
return { cartEntry, cartEntryEdge, cart };
},
});
addTodo: (root, { input: { id, userId, text } }) => {
const todoId = addTodo(id, userId, text, false);
const todo = getTodoOrThrow(todoId);
const outputFields = {
todoEdge: {
cursor: cursorForObjectInConnection([...getTodos(userId)], todo),
node: todo,
},
user: {
...getUserOrThrow(userId),
},
}
return outputFields;
},
changeTodoStatus: (root, { input: { id, complete, userId } }) => {
resolve: ({ todoId }) => {
const todo = getTodo(todoId);
return {
cursor: cursorForObjectInConnection(getTodos(), todo),
node: todo,
};
},
},
resolve: ({ localTodoId }) => {
const todo = getTodo(localTodoId);
return {
cursor: cursorForObjectInConnection(getTodos(), todo),
node: todo,
};
},
},
cursor: db.getPosts().then(posts => cursorForObjectInConnection(posts, newPost)),
node: newPost,