Fix sort with pagination and composite fields (#9150)

Fixes https://github.com/twentyhq/twenty/issues/8863

## Description
This PR fixes an issue with cursor-based pagination when dealing with
composite fields (like `fullName`). Previously, the pagination direction
was incorrectly determined for composite fields because the code wasn't
properly handling nested object structures in the `orderBy` parameter.
Refactored the code accordingly.
This commit is contained in:
Weiko
2024-12-19 16:41:04 +01:00
committed by GitHub
parent ed56a68b7c
commit 3f58a41d2f
4 changed files with 228 additions and 33 deletions

View File

@ -18,7 +18,9 @@ export enum OrderByDirection {
}
export type ObjectRecordOrderBy = Array<{
[Property in keyof ObjectRecord]?: OrderByDirection;
[Property in keyof ObjectRecord]?:
| OrderByDirection
| Record<string, OrderByDirection>;
}>;
export interface ObjectRecordDuplicateCriteria {