Benjamin Sampson
01/23/2019, 12:12 PMUser: {
posts(parent) {
return prisma.user({ id: parent.id }).posts();
},
},
Post: {
user(parent) {
return <http://prisma.post|prisma.post>({ id: parent.id }).user();
},
},
Any help would be highly appreciatednikolasburk
post and user on the Query type? Can you maybe share your full resolver implementation?Benjamin Sampson
01/23/2019, 10:51 PMme(parent, args, ctx, info) {
console.log(ctx.request.userId);
if (!ctx.request.userId) return null;
const user = ctx.db.query.user({ where: { id: ctx.request.userId }, info });
console.log(user);
return user;
},
async users(parent, args, ctx, info) {
if (!ctx.request.userId) throw new Error('You must be logged in');
await hasPermission(ctx.request.user, ['ADMIN']);
return ctx.db.query.users({}, info);
},
debates(parent, args, ctx, info) {
return ctx.db.query.debates({}, info);
},Benjamin Sampson
01/23/2019, 10:52 PMBenjamin Sampson
01/24/2019, 1:58 AMHarshit
01/24/2019, 4:56 AMnikolasburk
User and Post resolvers are using the client, in the me, users and debates resolvers you're using Prisma bindings. Is this intentional? 🙂 If no, I'd recommend using only the client in your resolvers.nikolasburk
Benjamin Sampson
01/24/2019, 9:22 PMBenjamin Sampson
01/24/2019, 9:22 PMBenjamin Sampson
01/25/2019, 11:18 PMinfo in my mutations