From the queries based on the Dato Starter Nuxtjs Blog repo, I’m trying to filter a simple model of categories.
What I want is to retrieve only the categories which are used at last once in any BlogPost model.
The Category model has only 2 fields (name and slug) and is used in the BlogPost model with a multiple relationnal field.
I’m sure it is possible but I’m lacking so much XP in graphql, how will do you handle that filter request ?
Sorry for the late reply but I don’t think you can only retrieve the categories used at least once in blog posts specifically.
You can do that in your code by fetching all the blog posts and filtering the categories that are used. But I don’t know if there’s a way to get exactly what you want.
Thanks you for your reply.
I was pretty sure it was impossible, but since we can get the “links” in Dato from admin panel ( = where a category model is used for), I thought maybe I was missing something
But I imagine you get it only from a frontend fetching and filtering all models to catch if there is any reference.