I’m working on an events booking app where I need to show to the user all available events during their availability.
So the user will spécify an array contains a couple of a start date and hour, an end date and hour (which forms the start and end timestamps for a single availability)
User availability exemple in my code
user:[
{
"availability_start": 1697282100,
"availability_end": 1697285700
},
{
"availability_start": 1697375700,
"availability_end": 1697379300
}
]
Event availability example of indexed data
“event”:[
{
"availability_start": 1697282100,
"availability_end": 1697285700
},
{
"availability_start": 1697375700,
"availability_end": 1697379300
}
]
So i need to make the following request
'filters' => "
((event.availability_start >=user[0].availability_start AND event.availability_end <=user[0].availability_end)
OR
(event.availability_start >=user[1].availability_start AND event.availability_end <=user[1].availability_end))”
But i’m getting filter (X AND Y) OR Z is not allowed, only (X OR Y) AND Z is allowed
Is there any other solution to make this request ?