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',
|
objectNamePlural: 'activities',
|
||||||
filter: {
|
filter: {
|
||||||
type: { eq: 'Task' },
|
type: { eq: 'Task' },
|
||||||
completedAt: { eq: null },
|
completedAt: { is: 'NULL' },
|
||||||
assigneeId: { eq: currentWorkspaceMember?.id },
|
assigneeId: { eq: currentWorkspaceMember?.id },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@ -28,7 +28,7 @@ export const useTasks = (entity?: ActivityTargetableEntity) => {
|
|||||||
skip: !entity && !selectedFilter,
|
skip: !entity && !selectedFilter,
|
||||||
filter: {
|
filter: {
|
||||||
type: { equals: 'Task' },
|
type: { equals: 'Task' },
|
||||||
completedAt: { neq: null },
|
completedAt: { is: 'NOT_NULL' },
|
||||||
...whereFilters,
|
...whereFilters,
|
||||||
},
|
},
|
||||||
orderBy: [
|
orderBy: [
|
||||||
@ -43,7 +43,7 @@ export const useTasks = (entity?: ActivityTargetableEntity) => {
|
|||||||
skip: !entity && !selectedFilter,
|
skip: !entity && !selectedFilter,
|
||||||
filter: {
|
filter: {
|
||||||
type: { equals: 'Task' },
|
type: { equals: 'Task' },
|
||||||
completedAt: { eq: null },
|
completedAt: { is: 'NULL' },
|
||||||
...whereFilters,
|
...whereFilters,
|
||||||
},
|
},
|
||||||
orderBy: [
|
orderBy: [
|
||||||
|
|||||||
@ -50,7 +50,7 @@ export const SettingsDevelopersApiKeys = () => {
|
|||||||
const { foundObjectMetadataItem } = useFindOneObjectMetadataItem({
|
const { foundObjectMetadataItem } = useFindOneObjectMetadataItem({
|
||||||
objectNameSingular: 'apiKey',
|
objectNameSingular: 'apiKey',
|
||||||
});
|
});
|
||||||
const filter = { revokedAt: { eq: null } };
|
const filter = { revokedAt: { is: 'NULL' } };
|
||||||
useFindManyObjectRecords({
|
useFindManyObjectRecords({
|
||||||
objectNamePlural: 'apiKeys',
|
objectNamePlural: 'apiKeys',
|
||||||
filter,
|
filter,
|
||||||
|
|||||||
@ -5,6 +5,8 @@ import {
|
|||||||
GraphQLFloat,
|
GraphQLFloat,
|
||||||
} from 'graphql';
|
} from 'graphql';
|
||||||
|
|
||||||
|
import { FilterIsNullable } from 'src/workspace/workspace-schema-builder/graphql-types/input/filter-is-nullable.input-type';
|
||||||
|
|
||||||
export const BigFloatFilterType = new GraphQLInputObjectType({
|
export const BigFloatFilterType = new GraphQLInputObjectType({
|
||||||
name: 'BigFloatFilter',
|
name: 'BigFloatFilter',
|
||||||
fields: {
|
fields: {
|
||||||
@ -15,5 +17,6 @@ export const BigFloatFilterType = new GraphQLInputObjectType({
|
|||||||
lt: { type: GraphQLFloat },
|
lt: { type: GraphQLFloat },
|
||||||
lte: { type: GraphQLFloat },
|
lte: { type: GraphQLFloat },
|
||||||
neq: { type: GraphQLFloat },
|
neq: { type: GraphQLFloat },
|
||||||
|
is: { type: FilterIsNullable },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@ -5,6 +5,8 @@ import {
|
|||||||
GraphQLInt,
|
GraphQLInt,
|
||||||
} from 'graphql';
|
} from 'graphql';
|
||||||
|
|
||||||
|
import { FilterIsNullable } from 'src/workspace/workspace-schema-builder/graphql-types/input/filter-is-nullable.input-type';
|
||||||
|
|
||||||
export const BigIntFilterType = new GraphQLInputObjectType({
|
export const BigIntFilterType = new GraphQLInputObjectType({
|
||||||
name: 'BigIntFilter',
|
name: 'BigIntFilter',
|
||||||
fields: {
|
fields: {
|
||||||
@ -15,5 +17,6 @@ export const BigIntFilterType = new GraphQLInputObjectType({
|
|||||||
lt: { type: GraphQLInt },
|
lt: { type: GraphQLInt },
|
||||||
lte: { type: GraphQLInt },
|
lte: { type: GraphQLInt },
|
||||||
neq: { type: GraphQLInt },
|
neq: { type: GraphQLInt },
|
||||||
|
is: { type: FilterIsNullable },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,8 +1,11 @@
|
|||||||
import { GraphQLBoolean, GraphQLInputObjectType } from 'graphql';
|
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({
|
export const BooleanFilterType = new GraphQLInputObjectType({
|
||||||
name: 'BooleanFilter',
|
name: 'BooleanFilter',
|
||||||
fields: {
|
fields: {
|
||||||
eq: { type: GraphQLBoolean },
|
eq: { type: GraphQLBoolean },
|
||||||
|
is: { type: FilterIsNullable },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,17 +1,18 @@
|
|||||||
import { GraphQLInputObjectType, GraphQLList, GraphQLNonNull } from 'graphql';
|
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';
|
import { DateScalarType } from 'src/workspace/workspace-schema-builder/graphql-types/scalars';
|
||||||
|
|
||||||
export const DateFilterType = new GraphQLInputObjectType({
|
export const DateFilterType = new GraphQLInputObjectType({
|
||||||
name: 'DateFilter',
|
name: 'DateFilter',
|
||||||
fields: {
|
fields: {
|
||||||
eq: { type: DateScalarType },
|
eq: { type: DateScalarType },
|
||||||
is: { type: DateScalarType },
|
|
||||||
gt: { type: DateScalarType },
|
gt: { type: DateScalarType },
|
||||||
gte: { type: DateScalarType },
|
gte: { type: DateScalarType },
|
||||||
in: { type: new GraphQLList(new GraphQLNonNull(DateScalarType)) },
|
in: { type: new GraphQLList(new GraphQLNonNull(DateScalarType)) },
|
||||||
lt: { type: DateScalarType },
|
lt: { type: DateScalarType },
|
||||||
lte: { type: DateScalarType },
|
lte: { type: DateScalarType },
|
||||||
neq: { type: DateScalarType },
|
neq: { type: DateScalarType },
|
||||||
|
is: { type: FilterIsNullable },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import { GraphQLInputObjectType, GraphQLList, GraphQLNonNull } from 'graphql';
|
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';
|
import { DateTimeScalarType } from 'src/workspace/workspace-schema-builder/graphql-types/scalars';
|
||||||
|
|
||||||
export const DatetimeFilterType = new GraphQLInputObjectType({
|
export const DatetimeFilterType = new GraphQLInputObjectType({
|
||||||
@ -12,5 +13,6 @@ export const DatetimeFilterType = new GraphQLInputObjectType({
|
|||||||
lt: { type: DateTimeScalarType },
|
lt: { type: DateTimeScalarType },
|
||||||
lte: { type: DateTimeScalarType },
|
lte: { type: DateTimeScalarType },
|
||||||
neq: { 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,
|
GraphQLNonNull,
|
||||||
} from 'graphql';
|
} from 'graphql';
|
||||||
|
|
||||||
|
import { FilterIsNullable } from 'src/workspace/workspace-schema-builder/graphql-types/input/filter-is-nullable.input-type';
|
||||||
|
|
||||||
export const FloatFilterType = new GraphQLInputObjectType({
|
export const FloatFilterType = new GraphQLInputObjectType({
|
||||||
name: 'FloatFilter',
|
name: 'FloatFilter',
|
||||||
fields: {
|
fields: {
|
||||||
@ -15,5 +17,6 @@ export const FloatFilterType = new GraphQLInputObjectType({
|
|||||||
lt: { type: GraphQLFloat },
|
lt: { type: GraphQLFloat },
|
||||||
lte: { type: GraphQLFloat },
|
lte: { type: GraphQLFloat },
|
||||||
neq: { type: GraphQLFloat },
|
neq: { type: GraphQLFloat },
|
||||||
|
is: { type: FilterIsNullable },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@ -5,6 +5,8 @@ import {
|
|||||||
GraphQLInt,
|
GraphQLInt,
|
||||||
} from 'graphql';
|
} from 'graphql';
|
||||||
|
|
||||||
|
import { FilterIsNullable } from 'src/workspace/workspace-schema-builder/graphql-types/input/filter-is-nullable.input-type';
|
||||||
|
|
||||||
export const IntFilterType = new GraphQLInputObjectType({
|
export const IntFilterType = new GraphQLInputObjectType({
|
||||||
name: 'IntFilter',
|
name: 'IntFilter',
|
||||||
fields: {
|
fields: {
|
||||||
@ -15,5 +17,6 @@ export const IntFilterType = new GraphQLInputObjectType({
|
|||||||
lt: { type: GraphQLInt },
|
lt: { type: GraphQLInt },
|
||||||
lte: { type: GraphQLInt },
|
lte: { type: GraphQLInt },
|
||||||
neq: { type: GraphQLInt },
|
neq: { type: GraphQLInt },
|
||||||
|
is: { type: FilterIsNullable },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@ -5,6 +5,8 @@ import {
|
|||||||
GraphQLString,
|
GraphQLString,
|
||||||
} from 'graphql';
|
} from 'graphql';
|
||||||
|
|
||||||
|
import { FilterIsNullable } from 'src/workspace/workspace-schema-builder/graphql-types/input/filter-is-nullable.input-type';
|
||||||
|
|
||||||
export const StringFilterType = new GraphQLInputObjectType({
|
export const StringFilterType = new GraphQLInputObjectType({
|
||||||
name: 'StringFilter',
|
name: 'StringFilter',
|
||||||
fields: {
|
fields: {
|
||||||
@ -20,5 +22,6 @@ export const StringFilterType = new GraphQLInputObjectType({
|
|||||||
ilike: { type: GraphQLString },
|
ilike: { type: GraphQLString },
|
||||||
regex: { type: GraphQLString },
|
regex: { type: GraphQLString },
|
||||||
iregex: { type: GraphQLString },
|
iregex: { type: GraphQLString },
|
||||||
|
is: { type: FilterIsNullable },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import { GraphQLInputObjectType, GraphQLList, GraphQLNonNull } from 'graphql';
|
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';
|
import { TimeScalarType } from 'src/workspace/workspace-schema-builder/graphql-types/scalars';
|
||||||
|
|
||||||
export const TimeFilterType = new GraphQLInputObjectType({
|
export const TimeFilterType = new GraphQLInputObjectType({
|
||||||
@ -12,5 +13,6 @@ export const TimeFilterType = new GraphQLInputObjectType({
|
|||||||
lt: { type: TimeScalarType },
|
lt: { type: TimeScalarType },
|
||||||
lte: { type: TimeScalarType },
|
lte: { type: TimeScalarType },
|
||||||
neq: { type: TimeScalarType },
|
neq: { type: TimeScalarType },
|
||||||
|
is: { type: FilterIsNullable },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import { GraphQLInputObjectType, GraphQLList } from 'graphql';
|
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';
|
import { UUIDScalarType } from 'src/workspace/workspace-schema-builder/graphql-types/scalars';
|
||||||
|
|
||||||
export const UUIDFilterType = new GraphQLInputObjectType({
|
export const UUIDFilterType = new GraphQLInputObjectType({
|
||||||
@ -8,5 +9,6 @@ export const UUIDFilterType = new GraphQLInputObjectType({
|
|||||||
eq: { type: UUIDScalarType },
|
eq: { type: UUIDScalarType },
|
||||||
in: { type: new GraphQLList(UUIDScalarType) },
|
in: { type: new GraphQLList(UUIDScalarType) },
|
||||||
neq: { type: UUIDScalarType },
|
neq: { type: UUIDScalarType },
|
||||||
|
is: { type: FilterIsNullable },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user