diff --git a/packages/twenty-front/src/generated/graphql.tsx b/packages/twenty-front/src/generated/graphql.tsx index 96ba375994cc..d5b0d74b2482 100644 --- a/packages/twenty-front/src/generated/graphql.tsx +++ b/packages/twenty-front/src/generated/graphql.tsx @@ -1,5 +1,5 @@ -import * as Apollo from '@apollo/client'; import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; export type Maybe = T | null; export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; @@ -379,8 +379,8 @@ export enum FieldMetadataType { Rating = 'RATING', RawJson = 'RAW_JSON', Relation = 'RELATION', - RichTextDeprecated = 'RICH_TEXT_DEPRECATED', RichText = 'RICH_TEXT', + RichTextDeprecated = 'RICH_TEXT_DEPRECATED', Select = 'SELECT', Text = 'TEXT', TsVector = 'TS_VECTOR', diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuCommands.tsx b/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuCommands.tsx index 6504bb5c256d..a3b8ee9fb982 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuCommands.tsx +++ b/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuCommands.tsx @@ -146,7 +146,11 @@ export const useCommandMenuCommands = () => { filter: deferredCommandMenuSearch ? makeOrFilterVariables([ { title: { ilike: `%${deferredCommandMenuSearch}%` } }, - { body: { ilike: `%${deferredCommandMenuSearch}%` } }, + { + body: { + blocknote: { ilike: `%${deferredCommandMenuSearch}%` }, + }, + }, ]) : undefined, limit: 3, @@ -158,7 +162,11 @@ export const useCommandMenuCommands = () => { filter: deferredCommandMenuSearch ? makeOrFilterVariables([ { title: { ilike: `%${deferredCommandMenuSearch}%` } }, - { body: { ilike: `%${deferredCommandMenuSearch}%` } }, + { + body: { + blocknote: { ilike: `%${deferredCommandMenuSearch}%` }, + }, + }, ]) : undefined, limit: 3, diff --git a/packages/twenty-front/src/modules/object-record/graphql/types/RecordGqlOperationFilter.ts b/packages/twenty-front/src/modules/object-record/graphql/types/RecordGqlOperationFilter.ts index 1d4fb29bc991..1671fea79414 100644 --- a/packages/twenty-front/src/modules/object-record/graphql/types/RecordGqlOperationFilter.ts +++ b/packages/twenty-front/src/modules/object-record/graphql/types/RecordGqlOperationFilter.ts @@ -129,6 +129,15 @@ export type RawJsonFilter = { is?: IsFilter; }; +export type RichTextLeafFilter = { + ilike?: string; +}; + +export type RichTextFilter = { + blocknote?: RichTextLeafFilter; + markdown?: RichTextLeafFilter; +}; + export type LeafFilter = | UUIDFilter | StringFilter @@ -144,6 +153,7 @@ export type LeafFilter = | PhonesFilter | ArrayFilter | RawJsonFilter + | RichTextFilter | undefined; export type AndObjectRecordFilter = { diff --git a/packages/twenty-server/src/engine/api/graphql/workspace-schema-builder/graphql-types/input/rich-text.input-type.ts b/packages/twenty-server/src/engine/api/graphql/workspace-schema-builder/graphql-types/input/rich-text.input-type.ts new file mode 100644 index 000000000000..f3a8cd078404 --- /dev/null +++ b/packages/twenty-server/src/engine/api/graphql/workspace-schema-builder/graphql-types/input/rich-text.input-type.ts @@ -0,0 +1,16 @@ +import { GraphQLInputObjectType, GraphQLString } from 'graphql'; + +const richTextLeafFilter = new GraphQLInputObjectType({ + name: 'RichTextLeafFilter', + fields: { + ilike: { type: GraphQLString }, + }, +}); + +export const RichTextFilterType = new GraphQLInputObjectType({ + name: 'RichTextFilter', + fields: { + blocknote: { type: richTextLeafFilter }, + markdown: { type: richTextLeafFilter }, + }, +}); diff --git a/packages/twenty-server/src/engine/api/graphql/workspace-schema-builder/services/type-mapper.service.ts b/packages/twenty-server/src/engine/api/graphql/workspace-schema-builder/services/type-mapper.service.ts index e960d438c0bc..d85d4c4fe61b 100644 --- a/packages/twenty-server/src/engine/api/graphql/workspace-schema-builder/services/type-mapper.service.ts +++ b/packages/twenty-server/src/engine/api/graphql/workspace-schema-builder/services/type-mapper.service.ts @@ -29,6 +29,7 @@ import { } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/input'; import { IDFilterType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/input/id-filter.input-type'; import { MultiSelectFilterType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/input/multi-select-filter.input-type'; +import { RichTextFilterType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/input/rich-text.input-type'; import { SelectFilterType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/input/select-filter.input-type'; import { BigFloatScalarType, @@ -116,6 +117,7 @@ export class TypeMapperService { [FieldMetadataType.POSITION, FloatFilterType], [FieldMetadataType.RAW_JSON, RawJsonFilterType], [FieldMetadataType.RICH_TEXT_DEPRECATED, StringFilterType], + [FieldMetadataType.RICH_TEXT, RichTextFilterType], [FieldMetadataType.ARRAY, ArrayFilterType], [FieldMetadataType.MULTI_SELECT, MultiSelectFilterType], [FieldMetadataType.SELECT, SelectFilterType], diff --git a/packages/twenty-server/src/engine/twenty-orm/utils/get-subfields-for-aggregate-operation.util.ts b/packages/twenty-server/src/engine/twenty-orm/utils/get-subfields-for-aggregate-operation.util.ts index a33a96afdd05..ffdd490fd602 100644 --- a/packages/twenty-server/src/engine/twenty-orm/utils/get-subfields-for-aggregate-operation.util.ts +++ b/packages/twenty-server/src/engine/twenty-orm/utils/get-subfields-for-aggregate-operation.util.ts @@ -36,6 +36,8 @@ export const getSubfieldsForAggregateOperation = ( 'primaryPhoneCountryCode', 'primaryPhoneCallingCode', ]; + case FieldMetadataType.RICH_TEXT: + return ['blocknote', 'markdown']; default: throw new Error(`Unsupported composite field type: ${fieldType}`); }