Ramsay Lanier
02/15/2018, 2:50 AMctx.db.query.rules
wallslide
02/15/2018, 3:04 AMmutation {
createUser(firstName: "Robert")
}
I assume things like where
, orderBy
, etc. are considered the args in a querywallslide
02/15/2018, 3:07 AM{where: ....}
in your args, but no gameId
Ramsay Lanier
02/15/2018, 3:09 AM{where...}
from args and try to add something to it before using it in the db query, it still does nothingRamsay Lanier
02/15/2018, 3:09 AMwallslide
02/15/2018, 3:10 AMasync function me(parent, args, ctx, info) {
const fullAuth0Id = await getAuth0Id(ctx)
return ctx.db.query.user({ where: { fullAuth0Id } }, info)
}
wallslide
02/15/2018, 3:11 AMRamsay Lanier
02/15/2018, 3:11 AMwallslide
02/15/2018, 3:12 AMRamsay Lanier
02/15/2018, 3:12 AMRamsay Lanier
02/15/2018, 3:12 AMwallslide
02/15/2018, 3:13 AMRamsay Lanier
02/15/2018, 3:15 AMRamsay Lanier
02/15/2018, 3:15 AMrules(parent, {where}, ctx, info) {
return ctx.db.query.rules({}, info)
},
wallslide
02/15/2018, 3:15 AMinfo
objectRamsay Lanier
02/15/2018, 3:15 AMwallslide
02/15/2018, 3:17 AMauthorId
right? Like, only if they are the author can they get the gameRules
?Ramsay Lanier
02/15/2018, 3:17 AMRamsay Lanier
02/15/2018, 3:17 AMrules(parent, {where}, ctx, info) {
const {id} = isLoggedIn(ctx)
return ctx.db.query.rules({where: {author: {id: id}}}, info)
},
Ramsay Lanier
02/15/2018, 3:17 AMRamsay Lanier
02/15/2018, 3:19 AMwallslide
02/15/2018, 3:19 AMrules(parent, args, ctx, info) {
const isAuthor = isAuthorCheck(ctx)
return isAuthor ? ctx.db.query.rules({}, info) : null
},
Ramsay Lanier
02/15/2018, 3:20 AMRamsay Lanier
02/15/2018, 3:21 AMRamsay Lanier
02/15/2018, 3:21 AMisAuthorCheck
actually checking? the Game itself doesn’t have an authorwallslide
02/15/2018, 3:22 AMRamsay Lanier
02/15/2018, 3:25 AMRamsay Lanier
02/15/2018, 3:26 AMRamsay Lanier
02/15/2018, 3:26 AMRamsay Lanier
02/15/2018, 3:27 AMcurrentUserRules
query and a publicRulesQuery
or something like thatwallslide
02/15/2018, 3:27 AMwallslide
02/15/2018, 3:28 AMRamsay Lanier
02/15/2018, 3:29 AMRamsay Lanier
02/15/2018, 3:29 AMwallslide
02/15/2018, 3:30 AMRamsay Lanier
02/15/2018, 3:30 AMme
query actually isn’t run so the current user id isn’t even in cache yetRamsay Lanier
02/15/2018, 3:32 AMRamsay Lanier
02/15/2018, 3:32 AMwallslide
02/15/2018, 3:35 AM