Hi, I am trying to do something like an anti join. Assuming I have 2 types
type Room {
Name: String! @id @search(by: [hash])
Booked: [Meeting]
}
type Meeting {
Room: Room! @hasInverse(field: Booked)
StartTime: DateTime! @search
EndTime: DateTime! @search
}
Now, I want to find all the free rooms in a given date range. That means they either have no related meeting at all or the meeting start and end date don’t fall within the date range.
I manage to filer for no booked or no meeting in date range, but I don’t manage to combine the two.
The below looks promising, but It doesn’t bring me room that don’t have any booked edges
{
queryRoom @cascade {
Name
Booked(filter: {
not: {
StartTime: {between: {min: "2021-06-06T09:00:00Z", max: "2021-06-06T11:00:00Z"}},
EndTime: {between: {min: "2021-06-06T09:00:00Z", max: "2021-06-06T11:00:00Z"}}
}
}) {
StartTime
EndTime
}
}
}
When I add a filter for has no bookings to the room, then I also don’t get the ones that have edges to Meetings, but the meeting is in not in the date range.
{
queryRoom(filter: {not: {has: Booked}}) @cascade {
Name
Booked(filter: {
not: {
StartTime: {between: {min: "2021-06-06T09:00:00Z", max: "2021-06-06T11:00:00Z"}},
EndTime: {between: {min: "2021-06-06T09:00:00Z", max: "2021-06-06T11:00:00Z"}}
}
}) {
StartTime
EndTime
}
}
}
"data": { "queryRoom": []},
Removing cascade does also not want I want. It will bring all non-booked but not the ones that are free in the date range.
Currently, I wish I could have a OR condition between the two filters.