From d8867d99eb6d257969c2a6ec4fb2a2a8943b9806 Mon Sep 17 00:00:00 2001 From: Norbert Csaba Herczeg Date: Fri, 14 Jun 2024 21:03:48 +0200 Subject: [PATCH] JNG-5775 fix filterable attributes (#72) --- .../ui/generator/typescript/rest/api/UiGeneralHelper.java | 4 ---- .../src/main/resources/rest/queryCustomizerSerializer.ts.hbs | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/judo-ui-typescript-rest-api/src/main/java/hu/blackbelt/judo/ui/generator/typescript/rest/api/UiGeneralHelper.java b/judo-ui-typescript-rest-api/src/main/java/hu/blackbelt/judo/ui/generator/typescript/rest/api/UiGeneralHelper.java index 8344820..7b69e3e 100644 --- a/judo-ui-typescript-rest-api/src/main/java/hu/blackbelt/judo/ui/generator/typescript/rest/api/UiGeneralHelper.java +++ b/judo-ui-typescript-rest-api/src/main/java/hu/blackbelt/judo/ui/generator/typescript/rest/api/UiGeneralHelper.java @@ -342,8 +342,4 @@ public static List getRelatedClasses(ClassType classType) { .sorted(Comparator.comparing(NamedElement::getFQName)) .toList(); } - - public static boolean isAttributeFilterable(AttributeType attributeType) { - return !(attributeType.getDataType() instanceof BinaryType) && !attributeType.getIsMemberTypeTransient(); - } } diff --git a/judo-ui-typescript-rest-api/src/main/resources/rest/queryCustomizerSerializer.ts.hbs b/judo-ui-typescript-rest-api/src/main/resources/rest/queryCustomizerSerializer.ts.hbs index da07d5e..8eb0306 100644 --- a/judo-ui-typescript-rest-api/src/main/resources/rest/queryCustomizerSerializer.ts.hbs +++ b/judo-ui-typescript-rest-api/src/main/resources/rest/queryCustomizerSerializer.ts.hbs @@ -15,7 +15,7 @@ export function serialize{{ classDataName classType "QueryCustomizer" }}(queryCu const { _seek, {{# each classType.attributes as |attribute| }} - {{# if (isAttributeFilterable attribute) }} + {{# if attribute.isFilterable }} {{ attribute.name }}: filter{{ firstToUpper attribute.name }}, {{/ if }} {{/ each }} @@ -24,7 +24,7 @@ export function serialize{{ classDataName classType "QueryCustomizer" }}(queryCu const result: any = { ...rest }; {{# each classType.attributes as |attribute| }} - {{# if (isAttributeFilterable attribute) }} + {{# if attribute.isFilterable }} if (Array.isArray(filter{{ firstToUpper attribute.name }})) { result.{{ attribute.name }} = filter{{ firstToUpper attribute.name }}.map(({ operator, value }) => ({ operator,