fix: not able to filter by nullable values (#2580)
Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -12,7 +12,7 @@ export const useCurrentUserTaskCount = () => {
|
||||
objectNamePlural: 'activities',
|
||||
filter: {
|
||||
type: { eq: 'Task' },
|
||||
completedAt: { eq: null },
|
||||
completedAt: { is: 'NULL' },
|
||||
assigneeId: { eq: currentWorkspaceMember?.id },
|
||||
},
|
||||
});
|
||||
|
||||
@ -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: [
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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 },
|
||||
},
|
||||
});
|
||||
|
||||
@ -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 },
|
||||
},
|
||||
});
|
||||
|
||||
@ -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 },
|
||||
},
|
||||
});
|
||||
|
||||
@ -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 },
|
||||
},
|
||||
});
|
||||
|
||||
@ -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 },
|
||||
},
|
||||
});
|
||||
|
||||
@ -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',
|
||||
},
|
||||
},
|
||||
});
|
||||
@ -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 },
|
||||
},
|
||||
});
|
||||
|
||||
@ -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 },
|
||||
},
|
||||
});
|
||||
|
||||
@ -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 },
|
||||
},
|
||||
});
|
||||
|
||||
@ -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 },
|
||||
},
|
||||
});
|
||||
|
||||
@ -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 },
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user