Add the support of Empty and Non-Empty filter (#5773)

This commit is contained in:
Pacifique LINJANJA
2024-06-20 18:18:12 +02:00
committed by GitHub
parent 9e08445bff
commit 9228667a57
11 changed files with 478 additions and 56 deletions

View File

@ -4,7 +4,31 @@ export const generateILikeFiltersForCompositeFields = (
filterString: string,
baseFieldName: string,
subFields: string[],
emptyCheck = false,
) => {
if (emptyCheck) {
return subFields.map((subField) => {
return {
or: [
{
[baseFieldName]: {
[subField]: {
is: 'NULL',
},
},
},
{
[baseFieldName]: {
[subField]: {
ilike: '',
},
},
},
],
};
});
}
return filterString
.split(' ')
.reduce((previousValue: RecordGqlOperationFilter[], currentValue) => {