add new globalSearch resolver + update useSearchRecords hook (#10457)

# Context

To enable search records sorting by ts_rank_cd / ts_rank, we have
decided to add a new search resolver serving `GlobalSearchRecordDTO`.

-----

- [x] Test to add - work in progress


closes https://github.com/twentyhq/core-team-issues/issues/357
This commit is contained in:
Etienne
2025-02-25 17:43:35 +01:00
committed by GitHub
parent 3f25d13999
commit 90a390ee33
27 changed files with 1126 additions and 256 deletions

View File

@ -146,6 +146,50 @@ export const graphqlMocks = {
},
});
}),
graphql.query('GlobalSearch', () => {
return HttpResponse.json({
data: {
globalSearch: [
{
__typename: 'GlobalSearchRecordDTO',
recordId: '20202020-2d40-4e49-8df4-9c6a049191de',
objectSingularName: 'person',
label: 'Louis Duss',
imageUrl: '',
tsRankCD: 0.2,
tsRank: 0.12158542,
},
{
__typename: 'GlobalSearchRecordDTO',
recordId: '20202020-3ec3-4fe3-8997-b76aa0bfa408',
objectSingularName: 'company',
label: 'Linkedin',
imageUrl: 'https://twenty-icons.com/linkedin.com',
tsRankCD: 0.2,
tsRank: 0.12158542,
},
{
__typename: 'GlobalSearchRecordDTO',
recordId: '20202020-3f74-492d-a101-2a70f50a1645',
objectSingularName: 'company',
label: 'Libeo',
imageUrl: 'https://twenty-icons.com/libeo.io',
tsRankCD: 0.2,
tsRank: 0.12158542,
},
{
__typename: 'GlobalSearchRecordDTO',
recordId: '20202020-ac73-4797-824e-87a1f5aea9e0',
objectSingularName: 'person',
label: 'Sylvie Palmer',
imageUrl: '',
tsRankCD: 0.1,
tsRank: 0.06079271,
},
],
},
});
}),
graphql.query('CombinedSearchRecords', () => {
return HttpResponse.json({
data: {