Hello @vitali.bakhur,
Welcome to Prismic community, and thanks for reaching out to us.
Yes, it is possible. I ran the code snippet you provided, and it works fine. There are two closing brackets missing from your snippet. By the way, I'm using JS, and I think you are using TS, but it shouldn't be a problem.
So it should look like this,
const data = allCategories.map(async (category) => {
const categoryGalleries = (
await client.get({
pageSize: 100,
predicates: [
predicate.at("my.gallery_page.gallery_category", category.id),
],
})
).results;
return { category, categoryGalleries };
});
And the way I like to use predicates is as follows:
const categoryGalleries = await client.get({
predicates: [
predicate.at("document.type", "gallery_page"),
predicate.at("my.gallery_page.gallery_category", category.id),
],
});
Get the document type first, then filter it.
I hope this helps.
Cheers,
Racheal.