From 75abf43dccc0145fca14217e948ea07a81afe8ec Mon Sep 17 00:00:00 2001 From: Wes Bos Date: Thu, 29 Mar 2018 11:21:03 -0400 Subject: apooolooo --- backend/database/prisma.yml | 2 +- backend/src/index.js | 5 +++++ backend/src/resolvers/Mutation.js | 5 +---- 3 files changed, 7 insertions(+), 5 deletions(-) (limited to 'backend') diff --git a/backend/database/prisma.yml b/backend/database/prisma.yml index b52f72b..8f4cbe1 100644 --- a/backend/database/prisma.yml +++ b/backend/database/prisma.yml @@ -18,4 +18,4 @@ datamodel: datamodel.graphql # cluster: ${env:PRISMA_CLUSTER} # cluster: local -# cluster: wesbos/prisma-us1 \ No newline at end of file +cluster: wesbos/prisma-us1 \ No newline at end of file diff --git a/backend/src/index.js b/backend/src/index.js index a37e1f7..df5eb29 100644 --- a/backend/src/index.js +++ b/backend/src/index.js @@ -2,6 +2,11 @@ const createServer = require('./createServer'); const server = createServer(); +server.express.use((req, res, next, db) => { + console.log('MIDDLEWARE!'); + next(); +}); + server.start({ port: 4444 }, deets => { console.log(`Server is running on http://localhost:${deets.port}`); }); diff --git a/backend/src/resolvers/Mutation.js b/backend/src/resolvers/Mutation.js index e4d568d..35037b8 100644 --- a/backend/src/resolvers/Mutation.js +++ b/backend/src/resolvers/Mutation.js @@ -177,6 +177,7 @@ const mutations = { }); if (existingCartItem) { + console.log('Existing'); return ctx.db.mutation.updateCartItem( { where: { id: existingCartItem.id }, @@ -278,20 +279,16 @@ const mutations = { }, async updateUser(parent, args, ctx, info) { const userId = getUserId(ctx); - console.log(userId); const updatedUser = await ctx.db.mutation.updateUser({ data: args, where: { id: userId }, }); - console.log(updatedUser); return updatedUser; }, async updatePermissions(parent, args, ctx, info) { const userId = getUserId(ctx); - await wait(20000); const currentUser = await ctx.db.query.user({ where: { id: userId } }, info); - console.log(currentUser); if (!currentUser) throw new Error('You Must be logged in to updat permissions!'); hasPermission(currentUser, ['ADMIN', 'PERMISSIONUPDATE']); return ctx.db.mutation.updateUser( -- cgit v1.3