Thease are the types and mutation im using in schema regarding this problem
type User @secret(field: "password") {
username: String! @id
email: String!
characters: [Character] @hasInverse(field: owner)
role: UserRole! @search
}
enum UserRole {
USER
ADMIN
}
type Character
@auth(
query: {
rule: """
query ($USER: String!) {
queryCharacter{
owner(filter:{username: { eq: $USER }}){
username
}
}
}
"""
}
) {
id: ID!
name: String!
race: String!
owner: User! @hasInverse(field: characters)
}
type Mutation {
signup(
username: String!
email: String!
password: String!
password2: String!
): signupPayload! @lambda
}
type signupPayload {
username: String
token: String
}
And this is what im having in insomnia:
mutation addUser(
$user: AddUserInput!,
){
addUser(input: [$user]){
user{
username
role
}
}
variables:
{
"user": {
"username": "user",
"email": "user@email.com",
"characters": [],
"password": "123456",
"role": "USER"
}
}