0

Is there a way in Hasura to run something such as a having which filters the results after all the data is returned after the where?

query {
    applications {
        permissions {
            user { 
                id
                first
                last
            }
        }
    }
}

I have a query where I want to return an application only if the current user is in the list of applications.permissions.user.

The below pseudo sql is something that I am looking for.

select * from ... where ... having applicaitons.permissions.user in permissions;

As of now I am getting an array that looks something like this:

{
  "applications": [
    {
      "permissions": [
        { "user": null }
      ]
    },
    {
      "permissions": [
        { "user": {"id":123,"first":"Billy","last":"Joe"} }
      ]
    }
  ]
}

What I would like is an array that looks like this (where "id" is the current user):

{
  "applications": [
    {
      "permissions": [
        { "user": {"id":123,"first":"Billy","last":"Joe"} }
      ]
    }
  ]
}
Get Off My Lawn
  • 34,175
  • 38
  • 176
  • 338
  • read docs - https://hasura.io/docs/latest/graphql/core/auth/authorization/index.html ? – xadm Mar 23 '21 at 15:53
  • I don't have control over the permissions, so I was hoping that I could do it outside of permissions. I can however talk to the hasura admin see if he can do anything. – Get Off My Lawn Mar 23 '21 at 15:55

0 Answers0