webiny-js icon indicating copy to clipboard operation
webiny-js copied to clipboard

filtering on meta properties

Open snstanton opened this issue 3 years ago • 2 comments

Is your feature request related to a problem? Please describe.

I am trying to write a utility script to bulk publish a set of revisions based on various criteria. Currently I do this by calling the manage api with something like:

query { a: listArticles { data { id meta { status revisions { id meta { status } } } } } }

And then I walk the whole table looking for a.data.meta.status == "draft". This mostly works, but is more expensive than necessary. Also, if the revisions contain drafts that aren't the latest version, then things get more complicated.

Describe the solution you'd like.

Ideally I would be able to add filters to the meta and revisions containers in the query like this:

query { a: listArticles { data { id meta(where: {status:"draft"}) { revisions ... or query { a: listArticles { data { id meta(where: {status:"draft"}) { revisions(where: {status:"draft"}) { ...

This would return articles that have at least one draft and only include the draft revisions in the result. I'm not sure if the meta.status projection is based solely on the last revision or not, so this might not be 100% correct if there have been revision deletions such that the latest version is no longer a draft.

Describe alternatives you've considered.

No response

snstanton avatar Nov 18 '21 20:11 snstanton

This issue is stale because it was opened 120 days with no activity. Remove the "stale-issue" label or leave a comment to revive the issue. Otherwise, it will be closed in 7 days.

webiny-bot avatar Apr 16 '22 07:04 webiny-bot

This issue is stale because it was opened 120 days with no activity. Remove the "stale-issue" label or leave a comment to revive the issue. Otherwise, it will be closed in 7 days.

webiny-bot avatar Aug 15 '22 07:08 webiny-bot