Order graphql results by calendar metadata value
Hi all,
I've the need to query a set of fragments and order the results by the value of a specific calendar metadata with name "cq:lastModified" or "cq:lastModified".
I found a way to extract the metadata values with this query:
query {
myFragmentList {
items {
_metadata {
calendarMetadata {
name
value
}
}
}
}
}
that gives me this result
...
"items": [
{
"_metadata": {
"calendarMetadata": [
{
"name": "jcr:created",
"value": "2023-10-19T15:24:21.482Z"
},
{
"name": "cq:lastPublished",
"value": "2024-01-11T21:45:00.668Z"
},
{
"name": "cq:lastModified",
"value": "2023-10-19T15:26:16.483Z"
}
]
}
},
...
What I want to do is to find a way to write the correct sort dotted expression to use the value of a calendarMetadata array element as sort field, for example:
query {
myFragmentList (sort: "_metadata.calendarMetadata[name='cq:lastModified'].value") {
...
}
}
but I cannot find a way to do that.
Any help is really appreciated.
Thank you.
Fabio