Lighthouse: Cannot use @can with Boolean return type

Created on 22 Jul 2019  路  1Comment  路  Source: nuwave/lighthouse

Hi there,

When using this mutation to delete some rows in the DB I get the following error:
"No class 'Boolean' was found for directive 'can'","message":"Internal server error","extensions":{"category":"schema"},"locations":[{"line":2,"column":21}]

deleteTeamsBookedSlots(
        start_date: DateTime!
        end_date: DateTime!
        team_id: ID!
    ): Boolean
    @can(ability: "block_dates")
    @field (resolver: "BookedSlotMutation@deleteTeamsBookedSlots")

If I delete the @can then the mutation works fine.

Is this a bug or am I doing something wrong? I've had a look through the @can documentation and don't see anything about certain return types being restricted.

Any help would be greatly appreciated, thank you.

question

Most helpful comment

Ignore me, I overwrote the model in the @can and it worked fine.

@can(ability: "block_dates" model: "App\\Models\\BookedSlot")

>All comments

Ignore me, I overwrote the model in the @can and it worked fine.

@can(ability: "block_dates" model: "App\\Models\\BookedSlot")

Was this page helpful?
0 / 5 - 0 ratings

Related issues

m1guelpf picture m1guelpf  路  3Comments

alexwhb picture alexwhb  路  4Comments

mehranabi picture mehranabi  路  3Comments

nguyentrongbang picture nguyentrongbang  路  3Comments

sadhakbj picture sadhakbj  路  4Comments