[Feature request] Enable filtering by null inside the roles interface

Dear 8base team, as this is my first post in this forum, first let me thank you for the amazing service you are building. 8base is a great help in getting my current project up and running, I’ve rarely felt so productive as a single developer before.

I’m currently faced with a situation in which in I need to make sure that only entities which do not have a relation with another entity yet (e.g. have a relation value of null) can be queried and mutated using the GQL API.

As discussed in a previous post, filtering by null generally seems to be possible on 8base: Filtering for null table fields

However, filtering by null does not seem to work when setting access permissions for user roles inside the 8base roles interface. Please take a look at the following screenshot:

33

When hovering above the underlined text, I get the following message:

Incorrect type. Expected “object”

And when trying to save, I’m greeted with the following error message:

Invalid filters

Also, filtering by {id: {is_empty: true}} does not have the desired effect.

I’d greatly appreciate if you could update the validation logic inside the roles interface and enable filtering by null - many thanks!

Hey @oliver!
Great to hear you like our platform.
Investigating your problem at the moment.
Why did { "id": { "is_empty": true } } not work for you btw?

Hi @Fomich, thanks for taking a look!

Regarding your question:

My invites table in this example contains 3 invites - 2 which were already accepted by users, 1 which is still pending. According to your GQL playground, { "id": { "is_empty": true } returns the following response:

Query:

query MyQuery {
  invitesList(filter: {acceptedBy: {id: {is_empty: true}}}) {
    items {
      id
    }
    count
  }
}

Response:

{
  "data": {
    "invitesList": {
      "items": [],
      "count": 0
    }
  }
}

However, the query / response I need in order to set the correct permissions (this works inside the GQL playground but not inside the roles interface) looks like this:

Query:

query MyQuery {
  invitesList(filter: {acceptedBy: null}) {
    items {
      id
    }
    count
  }
}

Response:

{
  "data": {
    "invitesList": {
      "items": [
        {
          "id": "cko0l6rgy00780cl011hc0loh"
        }
      ],
      "count": 1
    }
  }
}

I’m looking forward to your feedback!

@oliver Ok, got you.
I wrote my filter just for example. In your case you should use it like this:

query checkNull {
  InvitesList(filter: {acceptedBy: {is_empty: true}}) {
    items {
      id
      acceptedBy
    }
  }
}

Does it make sense?

Hi @Fomich, sorry, the 8base roles interface does not accept this filter as well. Please find a screenshot of your interface below:

Hmm… works just fine for me in API Explorer and Roles interface too.


image
What is the notification on green underline?
Is “acceptedBy” regular text field?
Are you sure you set permission in correct table?
What exact permission you trying to add filter to?

Hi @Fomich, thanks for giving it a shot!

acceptedBy is a relation field that connects my invites table to the users table:

These are the notifications I get when hovering over the underlined texts:

21

As mentioned before, I assume that this is mainly a validation problem inside the roles interface. Executing a query with filter: {acceptedBy: null} works perfectly fine inside the GQL playground.

The problem persists for Update and Read permissions alike.

@oliver
Hey, sorry for the long feedback, we’ll check this again and discuss it with the team in near sprint planning for the next release.

@Fomich Great, thanks for the update!