Monday, 7 January 2019

graphqljs - how to search enum type

I'm trying to define my enums as strings but it still seems to throw an error at how it doesn't understand the enum. I'm guessing I'm querying it wrong but I'm unsure how to do it correctly.

Definition:

status: {
    type: new graphql.GraphQLEnumType({
        name:
            "status",
        values:
        {
            "accepted":
            {
                value:
                    "accepted"
            },
            "pending":
            {
                value:
                    "pending"
            },
            "reviewing":
            {
                value:
                    "reviewing"
            },
        }
    })
},    

My query:

const payload =
    {
        account_id:
            instanced_accounts[0]._id,
        account_type:
            instanced_accounts[0].type,
        page:
            1,
        page_length:
            5,
        search_text:
            "",
        status:
            "accepted",
    }        
let query =
    new QueryBuilder(
        "retrieveContacts",
        payload
    )

I'm using graphlq-query-builder

When I run the query it returns:

"message": "Expected type status, found \"accepted\"; Did you mean the enum value accepted?"



from graphqljs - how to search enum type

No comments:

Post a Comment