cfree
11/17/2018, 6:09 PMtype Query {
candidates(role: Role!, accountStatus: AccountStatus!): [User]!
}
type User {
id: ID!
firstName: String!
lastName: String!
roles: [Role!]!
accountStatus: AccountStatus!
}
My resolver:
candidates(parent, args, ctx, info) {
return ctx.db.query.users({
where: {
role: args.role,
accountStatus: args.accountStatus,
},
}, info);
},
My query:
query CANDIDATES_QUERY {
candidates(role: FULL_MEMBER, accountStatus: ACTIVE) {
id
firstName
lastName
}
}
cfree
11/17/2018, 6:11 PMRole
enum is defined on the user as an array, it doesn't appear in prisma.graphql's UserWhereInput
input. AccountStatus does, though.cfree
11/17/2018, 6:12 PMcfree
11/17/2018, 6:14 PM{
"data": null,
"errors": [
{
"message": "Variable \"$_v0_where\" got invalid value {\"role\":\"FULL_MEMBER\",\"accountStatus\":\"ACTIVE\"}; Field \"role\" is not defined by type UserWhereInput.",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"candidates"
]
}
]
}
cfree
11/17/2018, 6:14 PMcfree
11/17/2018, 6:23 PMhinsxd
11/18/2018, 7:41 AMUser
has a roles
field, not role
.hinsxd
11/18/2018, 7:43 AMwhere: {
roles_in: args.role
}
cfree
11/26/2018, 2:37 AMroles_in
because roles
is an enumhinsxd
11/26/2018, 2:40 AMhinsxd
11/26/2018, 2:40 AMrole_in
hinsxd
11/26/2018, 2:41 AMenum Role {
Customer
Author
}
I have role_in
cfree
11/26/2018, 2:41 AMcfree
11/26/2018, 2:42 AMhinsxd
11/26/2018, 2:46 AMhinsxd
11/26/2018, 2:46 AMcfree
11/26/2018, 2:47 AMhinsxd
11/26/2018, 2:49 AMcfree
11/26/2018, 2:51 AMhasRole(currentUser, ['ADMIN', 'EXECUTIVE_COMMITTEE']);