Skip to content

Commit

Permalink
fix: update filter adapters for numbers and datetime
Browse files Browse the repository at this point in the history
  • Loading branch information
pacyL2K19 committed Jun 20, 2024
1 parent fe126f8 commit c922e6c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,7 @@ const applyEmptyFilters = (
break;
case 'DATE_TIME':
emptyRecordFilter = {
or: [
{ [correspondingField.name]: { eq: '' } as DateFilter },
{ [correspondingField.name]: { is: 'NULL' } as DateFilter },
],
[correspondingField.name]: { is: 'NULL' } as DateFilter,
};
break;
case 'RELATION':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,20 @@ export class QueryRunnerArgsFactory {
if (!fieldMetadata) {
return value;
}

switch (fieldMetadata.type) {
case 'NUMBER':
return Object.fromEntries(
Object.entries(value).map(([filterKey, filterValue]) => [
filterKey,
Number(filterValue),
]),
);
case 'NUMBER': {
if (value?.is === 'NULL') {
return value;
} else {
return Object.fromEntries(
Object.entries(value).map(([filterKey, filterValue]) => [
filterKey,
Number(filterValue),
]),
);
}
}
default:
return value;
}
Expand Down

0 comments on commit c922e6c

Please sign in to comment.