Skip to content

The open alternative to Salesforce, designed for AI.

fix: not able to filter by nullable values (#2580)

Jérémy M3ad30a04981b
diff --git a/front/src/modules/activities/tasks/hooks/useCurrentUserDueTaskCount.ts b/front/src/modules/activities/tasks/hooks/useCurrentUserDueTaskCount.ts
index 509c1e52f2d..ee3ad4bc168 100644
--- a/front/src/modules/activities/tasks/hooks/useCurrentUserDueTaskCount.ts
+++ b/front/src/modules/activities/tasks/hooks/useCurrentUserDueTaskCount.ts
@@ -12,7 +12,7 @@ export const useCurrentUserTaskCount = () => {
objectNamePlural: 'activities',
filter: {
type: { eq: 'Task' },
- completedAt: { eq: null },
+ completedAt: { is: 'NULL' },
assigneeId: { eq: currentWorkspaceMember?.id },
},
});
diff --git a/front/src/modules/activities/tasks/hooks/useTasks.ts b/front/src/modules/activities/tasks/hooks/useTasks.ts
index ee605de5d86..9a3c2447fd8 100644
--- a/front/src/modules/activities/tasks/hooks/useTasks.ts
+++ b/front/src/modules/activities/tasks/hooks/useTasks.ts
@@ -28,7 +28,7 @@ export const useTasks = (entity?: ActivityTargetableEntity) => {
skip: !entity && !selectedFilter,
filter: {
type: { equals: 'Task' },
- completedAt: { neq: null },
+ completedAt: { is: 'NOT_NULL' },
...whereFilters,
},
orderBy: [
@@ -43,7 +43,7 @@ export const useTasks = (entity?: ActivityTargetableEntity) => {
skip: !entity && !selectedFilter,
filter: {
type: { equals: 'Task' },
- completedAt: { eq: null },
+ completedAt: { is: 'NULL' },
...whereFilters,
},
orderBy: [
diff --git a/front/src/pages/settings/developers/api-keys/SettingsDevelopersApiKeys.tsx b/front/src/pages/settings/developers/api-keys/SettingsDevelopersApiKeys.tsx
index c24ee718599..4163a7518ee 100644
--- a/front/src/pages/settings/developers/api-keys/SettingsDevelopersApiKeys.tsx
+++ b/front/src/pages/settings/developers/api-keys/SettingsDevelopersApiKeys.tsx
@@ -50,7 +50,7 @@ export const SettingsDevelopersApiKeys = () => {
const { foundObjectMetadataItem } = useFindOneObjectMetadataItem({
objectNameSingular: 'apiKey',
});
- const filter = { revokedAt: { eq: null } };
+ const filter = { revokedAt: { is: 'NULL' } };
useFindManyObjectRecords({
objectNamePlural: 'apiKeys',
filter,
diff --git a/server/src/workspace/workspace-schema-builder/graphql-types/input/big-float-filter.input-type.ts b/server/src/workspace/workspace-schema-builder/graphql-types/input/big-float-filter.input-type.ts
index 217a7070eaf..245993626f1 100644
--- a/server/src/workspace/workspace-schema-builder/graphql-types/input/big-float-filter.input-type.ts
+++ b/server/src/workspace/workspace-schema-builder/graphql-types/input/big-float-filter.input-type.ts
@@ -5,6 +5,8 @@ import {
GraphQLFloat,
} from 'graphql';
+import { FilterIsNullable } from 'src/workspace/workspace-schema-builder/graphql-types/input/filter-is-nullable.input-type';
+
export const BigFloatFilterType = new GraphQLInputObjectType({
name: 'BigFloatFilter',
fields: {
@@ -15,5 +17,6 @@ export const BigFloatFilterType = new GraphQLInputObjectType({
lt: { type: GraphQLFloat },
lte: { type: GraphQLFloat },
neq: { type: GraphQLFloat },
+ is: { type: FilterIsNullable },
},
});
diff --git a/server/src/workspace/workspace-schema-builder/graphql-types/input/big-int-filter.input-type.ts b/server/src/workspace/workspace-schema-builder/graphql-types/input/big-int-filter.input-type.ts
index ab404aad6af..3d97c17248c 100644
--- a/server/src/workspace/workspace-schema-builder/graphql-types/input/big-int-filter.input-type.ts
+++ b/server/src/workspace/workspace-schema-builder/graphql-types/input/big-int-filter.input-type.ts
@@ -5,6 +5,8 @@ import {
GraphQLInt,
} from 'graphql';
+import { FilterIsNullable } from 'src/workspace/workspace-schema-builder/graphql-types/input/filter-is-nullable.input-type';
+
export const BigIntFilterType = new GraphQLInputObjectType({
name: 'BigIntFilter',
fields: {
@@ -15,5 +17,6 @@ export const BigIntFilterType = new GraphQLInputObjectType({
lt: { type: GraphQLInt },
lte: { type: GraphQLInt },
neq: { type: GraphQLInt },
+ is: { type: FilterIsNullable },
},
});
diff --git a/server/src/workspace/workspace-schema-builder/graphql-types/input/boolean-filter.input-type.ts b/server/src/workspace/workspace-schema-builder/graphql-types/input/boolean-filter.input-type.ts
index 79f1480ce9c..c96f05341e7 100644
--- a/server/src/workspace/workspace-schema-builder/graphql-types/input/boolean-filter.input-type.ts
+++ b/server/src/workspace/workspace-schema-builder/graphql-types/input/boolean-filter.input-type.ts
@@ -1,8 +1,11 @@
import { GraphQLBoolean, GraphQLInputObjectType } from 'graphql';
+import { FilterIsNullable } from 'src/workspace/workspace-schema-builder/graphql-types/input/filter-is-nullable.input-type';
+
export const BooleanFilterType = new GraphQLInputObjectType({
name: 'BooleanFilter',
fields: {
eq: { type: GraphQLBoolean },
+ is: { type: FilterIsNullable },
},
});
diff --git a/server/src/workspace/workspace-schema-builder/graphql-types/input/date-filter.input-type.ts b/server/src/workspace/workspace-schema-builder/graphql-types/input/date-filter.input-type.ts
index 2b56e9352fd..8344f4bee9f 100644
--- a/server/src/workspace/workspace-schema-builder/graphql-types/input/date-filter.input-type.ts
+++ b/server/src/workspace/workspace-schema-builder/graphql-types/input/date-filter.input-type.ts
@@ -1,17 +1,18 @@
import { GraphQLInputObjectType, GraphQLList, GraphQLNonNull } from 'graphql';
+import { FilterIsNullable } from 'src/workspace/workspace-schema-builder/graphql-types/input/filter-is-nullable.input-type';
import { DateScalarType } from 'src/workspace/workspace-schema-builder/graphql-types/scalars';
export const DateFilterType = new GraphQLInputObjectType({
name: 'DateFilter',
fields: {
eq: { type: DateScalarType },
- is: { type: DateScalarType },
gt: { type: DateScalarType },
gte: { type: DateScalarType },
in: { type: new GraphQLList(new GraphQLNonNull(DateScalarType)) },
lt: { type: DateScalarType },
lte: { type: DateScalarType },
neq: { type: DateScalarType },
+ is: { type: FilterIsNullable },
},
});
diff --git a/server/src/workspace/workspace-schema-builder/graphql-types/input/date-time-filter.input-type.ts b/server/src/workspace/workspace-schema-builder/graphql-types/input/date-time-filter.input-type.ts
index d5ac00d5278..64580bd3585 100644
--- a/server/src/workspace/workspace-schema-builder/graphql-types/input/date-time-filter.input-type.ts
+++ b/server/src/workspace/workspace-schema-builder/graphql-types/input/date-time-filter.input-type.ts
@@ -1,5 +1,6 @@
import { GraphQLInputObjectType, GraphQLList, GraphQLNonNull } from 'graphql';
+import { FilterIsNullable } from 'src/workspace/workspace-schema-builder/graphql-types/input/filter-is-nullable.input-type';
import { DateTimeScalarType } from 'src/workspace/workspace-schema-builder/graphql-types/scalars';
export const DatetimeFilterType = new GraphQLInputObjectType({
@@ -12,5 +13,6 @@ export const DatetimeFilterType = new GraphQLInputObjectType({
lt: { type: DateTimeScalarType },
lte: { type: DateTimeScalarType },
neq: { type: DateTimeScalarType },
+ is: { type: FilterIsNullable },
},
});
diff --git a/server/src/workspace/workspace-schema-builder/graphql-types/input/filter-is-nullable.input-type.ts b/server/src/workspace/workspace-schema-builder/graphql-types/input/filter-is-nullable.input-type.ts
new file mode 100644
index 00000000000..4acc83e2eae
--- /dev/null
+++ b/server/src/workspace/workspace-schema-builder/graphql-types/input/filter-is-nullable.input-type.ts
@@ -0,0 +1,16 @@
+import { GraphQLEnumType } from 'graphql';
+
+export const FilterIsNullable = new GraphQLEnumType({
+ name: 'FilterIsNullable',
+ description: 'This enum to filter by nullability',
+ values: {
+ NULL: {
+ value: 'NULL',
+ description: 'Nulish values',
+ },
+ NOT_NULL: {
+ value: 'NOT_NULL',
+ description: 'Non-nulish values',
+ },
+ },
+});
diff --git a/server/src/workspace/workspace-schema-builder/graphql-types/input/float-filter.input-type.ts b/server/src/workspace/workspace-schema-builder/graphql-types/input/float-filter.input-type.ts
index 12e3c89e8c1..ee51bbe33b3 100644
--- a/server/src/workspace/workspace-schema-builder/graphql-types/input/float-filter.input-type.ts
+++ b/server/src/workspace/workspace-schema-builder/graphql-types/input/float-filter.input-type.ts
@@ -5,6 +5,8 @@ import {
GraphQLNonNull,
} from 'graphql';
+import { FilterIsNullable } from 'src/workspace/workspace-schema-builder/graphql-types/input/filter-is-nullable.input-type';
+
export const FloatFilterType = new GraphQLInputObjectType({
name: 'FloatFilter',
fields: {
@@ -15,5 +17,6 @@ export const FloatFilterType = new GraphQLInputObjectType({
lt: { type: GraphQLFloat },
lte: { type: GraphQLFloat },
neq: { type: GraphQLFloat },
+ is: { type: FilterIsNullable },
},
});
diff --git a/server/src/workspace/workspace-schema-builder/graphql-types/input/int-filter.input-type.ts b/server/src/workspace/workspace-schema-builder/graphql-types/input/int-filter.input-type.ts
index 9b4c33aedd9..9ff27926d78 100644
--- a/server/src/workspace/workspace-schema-builder/graphql-types/input/int-filter.input-type.ts
+++ b/server/src/workspace/workspace-schema-builder/graphql-types/input/int-filter.input-type.ts
@@ -5,6 +5,8 @@ import {
GraphQLInt,
} from 'graphql';
+import { FilterIsNullable } from 'src/workspace/workspace-schema-builder/graphql-types/input/filter-is-nullable.input-type';
+
export const IntFilterType = new GraphQLInputObjectType({
name: 'IntFilter',
fields: {
@@ -15,5 +17,6 @@ export const IntFilterType = new GraphQLInputObjectType({
lt: { type: GraphQLInt },
lte: { type: GraphQLInt },
neq: { type: GraphQLInt },
+ is: { type: FilterIsNullable },
},
});
diff --git a/server/src/workspace/workspace-schema-builder/graphql-types/input/string-filter.input-type.ts b/server/src/workspace/workspace-schema-builder/graphql-types/input/string-filter.input-type.ts
index 6ea2bf9c144..1c28b5d68d1 100644
--- a/server/src/workspace/workspace-schema-builder/graphql-types/input/string-filter.input-type.ts
+++ b/server/src/workspace/workspace-schema-builder/graphql-types/input/string-filter.input-type.ts
@@ -5,6 +5,8 @@ import {
GraphQLString,
} from 'graphql';
+import { FilterIsNullable } from 'src/workspace/workspace-schema-builder/graphql-types/input/filter-is-nullable.input-type';
+
export const StringFilterType = new GraphQLInputObjectType({
name: 'StringFilter',
fields: {
@@ -20,5 +22,6 @@ export const StringFilterType = new GraphQLInputObjectType({
ilike: { type: GraphQLString },
regex: { type: GraphQLString },
iregex: { type: GraphQLString },
+ is: { type: FilterIsNullable },
},
});
diff --git a/server/src/workspace/workspace-schema-builder/graphql-types/input/time-filter.input-type.ts b/server/src/workspace/workspace-schema-builder/graphql-types/input/time-filter.input-type.ts
index eb71dd6942d..9a652812188 100644
--- a/server/src/workspace/workspace-schema-builder/graphql-types/input/time-filter.input-type.ts
+++ b/server/src/workspace/workspace-schema-builder/graphql-types/input/time-filter.input-type.ts
@@ -1,5 +1,6 @@
import { GraphQLInputObjectType, GraphQLList, GraphQLNonNull } from 'graphql';
+import { FilterIsNullable } from 'src/workspace/workspace-schema-builder/graphql-types/input/filter-is-nullable.input-type';
import { TimeScalarType } from 'src/workspace/workspace-schema-builder/graphql-types/scalars';
export const TimeFilterType = new GraphQLInputObjectType({
@@ -12,5 +13,6 @@ export const TimeFilterType = new GraphQLInputObjectType({
lt: { type: TimeScalarType },
lte: { type: TimeScalarType },
neq: { type: TimeScalarType },
+ is: { type: FilterIsNullable },
},
});
diff --git a/server/src/workspace/workspace-schema-builder/graphql-types/input/uuid-filter.input-type.ts b/server/src/workspace/workspace-schema-builder/graphql-types/input/uuid-filter.input-type.ts
index 9cdd76a7f37..4cfba83650d 100644
--- a/server/src/workspace/workspace-schema-builder/graphql-types/input/uuid-filter.input-type.ts
+++ b/server/src/workspace/workspace-schema-builder/graphql-types/input/uuid-filter.input-type.ts
@@ -1,5 +1,6 @@
import { GraphQLInputObjectType, GraphQLList } from 'graphql';
+import { FilterIsNullable } from 'src/workspace/workspace-schema-builder/graphql-types/input/filter-is-nullable.input-type';
import { UUIDScalarType } from 'src/workspace/workspace-schema-builder/graphql-types/scalars';
export const UUIDFilterType = new GraphQLInputObjectType({
@@ -8,5 +9,6 @@ export const UUIDFilterType = new GraphQLInputObjectType({
eq: { type: UUIDScalarType },
in: { type: new GraphQLList(UUIDScalarType) },
neq: { type: UUIDScalarType },
+ is: { type: FilterIsNullable },
},
});