summaryrefslogtreecommitdiffstats
path: root/backend
diff options
context:
space:
mode:
authorWes Bos <wesbos@gmail.com>2018-03-29 11:21:03 -0400
committerWes Bos <wesbos@gmail.com>2018-03-29 11:21:03 -0400
commit75abf43dccc0145fca14217e948ea07a81afe8ec (patch)
tree0e84dbbed0003d5ecc4df364fa491435793b1e79 /backend
parent65c524251d49ade9d44a62337f3c1c1fed6eedd0 (diff)
apooolooo
Diffstat (limited to 'backend')
-rw-r--r--backend/database/prisma.yml2
-rw-r--r--backend/src/index.js5
-rw-r--r--backend/src/resolvers/Mutation.js5
3 files changed, 7 insertions, 5 deletions
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(