Hello @cooki23,
I understand your question. You want kind of a not in operator ?
That could be a possibility. For example you override the behaviour of not_equal filter but I guess it would require complexe queries to compute all the ids that matchs.
{
field: 'fakeMissingTags',
isFilterable: true,
type: 'String',
get: (product) => {
// you can compute something like a string of missing tags
return 'we dont care';
},
filter({ condition, where }) {
const value = !!condition.value && condition.value;
switch (condition.operator) {
// Choose whatever filter you want to implement
case 'not_equal':
const complexeQueriesToFindProdutsIds = await models.products
.findAll({
include: [{
model: models.tags,
as: "tagsThroughProductTags",
where: { [Op.not]: { tagType: 0 } },
}],
});
const ids = complexeQueriesToFindProdutsIds.map(product => product.id);
// Feed it with the array of ids.
return { id: { [Op.in]: ids } };
// ... implement the operator you want: equal for example pour the presence comportement
default:
return null;
}
},
}