Hello, we use Directus and we love it but I think it missing some basic filters
on of them was _ineq which we need to filter some conversation before create new conversation if smaller is already exists then return it without create new conversation
anyway, I tried _eq and _in and they do filter for array if any of them contain the string then return it
// notice payload.to is array contain the following
// [{
// directus_users_id: {
// id: "user id"
// }
// }]
if (!payload.broadcast && payload?.to?.length) {
let conversation = await directus.items("conversations").readByQuery({
filter: {
_or: [
{
broadcast: {
_eq: false
},
from: {
_eq: user.id
},
to: {
// filter many to many exactly by id
directus_users_id: {
id: {
_in: payload.to.map(({ directus_users_id: { id } }) => id)
},
}
}
},
]
},
limit: 1
});
if(conversation.data.length) {
return conversation.data[0];
}
}