Skip to content

Commit 9db76c8

Browse files
realSpokNicolas Moreau
and
Nicolas Moreau
authored
feat(filters): support Not In operator (#1302)
* feat: support notin operator * chore: remove wrong changes * test: add test --------- Co-authored-by: Nicolas Moreau <nicolas.moreau76@gmail.com>
1 parent d01d303 commit 9db76c8

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

packages/agent/src/utils/condition-tree-parser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export default class ConditionTreeParser {
7676
return 'Number';
7777
}
7878

79-
if (filter.operator === 'In') {
79+
if (['In', 'NotIn'].includes(filter.operator)) {
8080
return [fieldSchema.columnType];
8181
}
8282

packages/agent/test/utils/condition-tree-parser.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ describe('ConditionTreeParser', () => {
5858
expect(tree).toStrictEqual(new ConditionTreeLeaf('id', 'In', ['id1', 'id2', 'id3']));
5959
});
6060

61+
test('should work with not in and string', () => {
62+
const tree = ConditionTreeParser.fromPlainObject(collection, {
63+
field: 'id',
64+
operator: 'not_in',
65+
value: 'id1,id2 , id3',
66+
});
67+
68+
expect(tree).toStrictEqual(new ConditionTreeLeaf('id', 'NotIn', ['id1', 'id2', 'id3']));
69+
});
70+
6171
test('should work with in and number', () => {
6272
const tree = ConditionTreeParser.fromPlainObject(collection, {
6373
field: 'number',

0 commit comments

Comments
 (0)