I find the orQueries logic in the /task
API hard to comprehend and very limiting in expression power. Given the example used in the doc:
{
"assignee": "John Munda",
"orQueries": [
{
"name": "Approve Invoice",
"priority": 5
},
{
"suspended": false,
"taskDefinitionKey": "approveInvoice"
}
]
}
I had expected it would to be translated into an SQL where
clause like:
where asignee='John Munda' and ((name='Approve Invoice' and priority=5) or (suspended=false and taskDefinitionKey='approveInvoice'))
But I was perplexed to find it actually turned into:
where asignee='John Munda' and (name='Approve Invoice' or priority=5) and (suspended=false or taskDefinitionKey='approveInvoice')
With this kind of transformation, I can not find a proper expression for some of my intentions. For instances, I’d like to get a list of all tasks with defintion key A
or B
which are due date within 3 days AND all overdue tasks. That is, I’d like the the final SQL where clause to look like:
where (taskDefinitionKey in ['A', 'B'] and due < now + 3days) or due < now
How shall I write my query for this purpose?
I think to be make more flexible task queries, we need a top-level OR query in stead of a top-level AND.