summaryrefslogtreecommitdiffstats
path: root/finished-application
diff options
context:
space:
mode:
authorWes Bos <wesbos@gmail.com>2018-08-14 15:39:34 -0400
committerWes Bos <wesbos@gmail.com>2018-08-14 15:39:34 -0400
commitee09df7dee16a7b44711159c60c54cc9365be35e (patch)
treef44bfca6d65c0082ca267300c33ff8186a713ec0 /finished-application
parenta07aad867cdfc3d5f270be25e571901af500f625 (diff)
stepped
Diffstat (limited to 'finished-application')
-rw-r--r--finished-application/backend/src/resolvers/Query.js7
-rw-r--r--finished-application/backend/src/schema.graphql1
-rw-r--r--finished-application/frontend/components/PleaseSignIn.js2
3 files changed, 9 insertions, 1 deletions
diff --git a/finished-application/backend/src/resolvers/Query.js b/finished-application/backend/src/resolvers/Query.js
index 51c2c42..a51ead5 100644
--- a/finished-application/backend/src/resolvers/Query.js
+++ b/finished-application/backend/src/resolvers/Query.js
@@ -5,6 +5,13 @@ const { forwardTo } = require('prisma-binding');
const Query = {
items: forwardTo('db'),
itemsConnection: forwardTo('db'),
+ async users(parent, args, ctx, info) {
+ if (!ctx.request.userId) {
+ throw new Error('Insufficient Permissions');
+ }
+
+ return ctx.db.query.users({}, info);
+ },
async order(parent, args, ctx, info) {
// 1. make sure they are signed in
diff --git a/finished-application/backend/src/schema.graphql b/finished-application/backend/src/schema.graphql
index 07533eb..9c4a200 100644
--- a/finished-application/backend/src/schema.graphql
+++ b/finished-application/backend/src/schema.graphql
@@ -3,6 +3,7 @@
type Query {
me: User
+ users: [User]!
order(id: ID!): Order!
orders(where: OrderWhereInput, orderBy: OrderOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [Order]!
items(where: ItemWhereInput, orderBy: ItemOrderByInput, skip: Int, after: String, before: String, first: Int, last: Int): [Item]!
diff --git a/finished-application/frontend/components/PleaseSignIn.js b/finished-application/frontend/components/PleaseSignIn.js
index 5646749..3cd7267 100644
--- a/finished-application/frontend/components/PleaseSignIn.js
+++ b/finished-application/frontend/components/PleaseSignIn.js
@@ -18,7 +18,7 @@ const PleaseSignIn = props => (
}
// check if they need permissions
if (props.allowedPermissions) {
- // check if they NO permissions, or they don't meet the requmrenets
+ // check if they have NO permissions, or they don't meet the requmrenets
if (
!data.me.permissions ||
!props.allowedPermissions.some(permission => data.me.permissions.includes(permission))