Fix on view filters (#14462)
Fixes https://github.com/twentyhq/twenty/issues/14058
This commit is contained in:
+18
-1
@@ -1,3 +1,4 @@
|
||||
import { FieldMetadataType } from 'twenty-shared/types';
|
||||
import { capitalize } from 'twenty-shared/utils';
|
||||
|
||||
import {
|
||||
@@ -51,7 +52,10 @@ export class GraphqlQueryOrderFieldParser {
|
||||
|
||||
Object.assign(acc, compositeOrder);
|
||||
} else {
|
||||
acc[`"${objectNameSingular}"."${key}"`] =
|
||||
const orderByCasting =
|
||||
this.getOptionalOrderByCasting(fieldMetadata);
|
||||
|
||||
acc[`"${objectNameSingular}"."${key}"${orderByCasting}`] =
|
||||
this.convertOrderByToFindOptionsOrder(
|
||||
value as OrderByDirection,
|
||||
isForwardPagination,
|
||||
@@ -65,6 +69,19 @@ export class GraphqlQueryOrderFieldParser {
|
||||
);
|
||||
}
|
||||
|
||||
private getOptionalOrderByCasting(
|
||||
fieldMetadata: Pick<FieldMetadataEntity, 'type'>,
|
||||
): string {
|
||||
if (
|
||||
fieldMetadata.type === FieldMetadataType.SELECT ||
|
||||
fieldMetadata.type === FieldMetadataType.MULTI_SELECT
|
||||
) {
|
||||
return '::text';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
private parseCompositeFieldForOrder(
|
||||
fieldMetadata: FieldMetadataEntity,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
|
||||
Reference in New Issue
Block a user