Skip to content

Commit

Permalink
Fix command menu note and task search
Browse files Browse the repository at this point in the history
  • Loading branch information
ad-elias committed Jan 11, 2025
1 parent 513a623 commit fabfd83
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/twenty-front/src/generated/graphql.tsx
Original file line number Diff line number Diff line change
@@ -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> = T | null;
export type InputMaybe<T> = Maybe<T>;
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
Expand Down Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,11 @@ export const useCommandMenuCommands = () => {
filter: deferredCommandMenuSearch
? makeOrFilterVariables([
{ title: { ilike: `%${deferredCommandMenuSearch}%` } },
{ body: { ilike: `%${deferredCommandMenuSearch}%` } },
{
body: {
blocknote: { ilike: `%${deferredCommandMenuSearch}%` },
},
},
])
: undefined,
limit: 3,
Expand All @@ -158,7 +162,11 @@ export const useCommandMenuCommands = () => {
filter: deferredCommandMenuSearch
? makeOrFilterVariables([
{ title: { ilike: `%${deferredCommandMenuSearch}%` } },
{ body: { ilike: `%${deferredCommandMenuSearch}%` } },
{
body: {
blocknote: { ilike: `%${deferredCommandMenuSearch}%` },
},
},
])
: undefined,
limit: 3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -144,6 +153,7 @@ export type LeafFilter =
| PhonesFilter
| ArrayFilter
| RawJsonFilter
| RichTextFilter
| undefined;

export type AndObjectRecordFilter = {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 },
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
}
Expand Down

0 comments on commit fabfd83

Please sign in to comment.