From d3075df17db7101c7787a821ccf9abf8a7632b36 Mon Sep 17 00:00:00 2001 From: Max Thonagel <12283268+thoniTUB@users.noreply.github.com> Date: Thu, 12 Sep 2024 10:36:35 +0200 Subject: [PATCH 1/3] Bring back type structure for frontend --- .../apiv1/frontend/FrontendResultType.java | 28 +++++++++++++++++++ .../apiv1/frontend/FrontendSelect.java | 2 +- .../concepts/FrontEndConceptBuilder.java | 3 +- 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 backend/src/main/java/com/bakdata/conquery/apiv1/frontend/FrontendResultType.java diff --git a/backend/src/main/java/com/bakdata/conquery/apiv1/frontend/FrontendResultType.java b/backend/src/main/java/com/bakdata/conquery/apiv1/frontend/FrontendResultType.java new file mode 100644 index 0000000000..4a574dd295 --- /dev/null +++ b/backend/src/main/java/com/bakdata/conquery/apiv1/frontend/FrontendResultType.java @@ -0,0 +1,28 @@ +package com.bakdata.conquery.apiv1.frontend; + +import jakarta.validation.constraints.NotNull; + +import com.bakdata.conquery.models.types.ResultType; +import lombok.experimental.SuperBuilder; + +@SuperBuilder +public class FrontendResultType { + @NotNull + String type; + + @SuperBuilder + public static class List extends FrontendResultType { + @NotNull + FrontendResultType elementType; + } + + public static FrontendResultType from(ResultType resultType) { + if (resultType instanceof ResultType.ListT listT) { + return List.builder() + .elementType(from(listT.getElementType())) + .type(listT.typeInfo()).build(); + } + + return FrontendResultType.builder().type(resultType.typeInfo()).build(); + } +} diff --git a/backend/src/main/java/com/bakdata/conquery/apiv1/frontend/FrontendSelect.java b/backend/src/main/java/com/bakdata/conquery/apiv1/frontend/FrontendSelect.java index 95f9e1c94b..4bf5cf5f4f 100644 --- a/backend/src/main/java/com/bakdata/conquery/apiv1/frontend/FrontendSelect.java +++ b/backend/src/main/java/com/bakdata/conquery/apiv1/frontend/FrontendSelect.java @@ -14,7 +14,7 @@ public class FrontendSelect { private SelectId id; private String label; private String description; - private String resultType; + private FrontendResultType resultType; @JsonProperty("default") private Boolean isDefault; } diff --git a/backend/src/main/java/com/bakdata/conquery/models/datasets/concepts/FrontEndConceptBuilder.java b/backend/src/main/java/com/bakdata/conquery/models/datasets/concepts/FrontEndConceptBuilder.java index 721fc2c920..6dfb73ab7e 100644 --- a/backend/src/main/java/com/bakdata/conquery/models/datasets/concepts/FrontEndConceptBuilder.java +++ b/backend/src/main/java/com/bakdata/conquery/models/datasets/concepts/FrontEndConceptBuilder.java @@ -12,6 +12,7 @@ import com.bakdata.conquery.apiv1.frontend.FrontendFilterConfiguration; import com.bakdata.conquery.apiv1.frontend.FrontendList; import com.bakdata.conquery.apiv1.frontend.FrontendNode; +import com.bakdata.conquery.apiv1.frontend.FrontendResultType; import com.bakdata.conquery.apiv1.frontend.FrontendRoot; import com.bakdata.conquery.apiv1.frontend.FrontendSecondaryId; import com.bakdata.conquery.apiv1.frontend.FrontendSelect; @@ -172,7 +173,7 @@ public FrontendSelect createSelect(Select select) { .id(select.getId()) .label(select.getLabel()) .description(select.getDescription()) - .resultType(select.getResultType().typeInfo()) + .resultType(FrontendResultType.from(select.getResultType())) .isDefault(select.isDefault()) .build(); } From ccc446262330ecd34f80631c988ad84f3368494c Mon Sep 17 00:00:00 2001 From: Max Thonagel <12283268+thoniTUB@users.noreply.github.com> Date: Thu, 12 Sep 2024 11:47:51 +0200 Subject: [PATCH 2/3] adds getters to container type --- .../bakdata/conquery/apiv1/frontend/FrontendResultType.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/src/main/java/com/bakdata/conquery/apiv1/frontend/FrontendResultType.java b/backend/src/main/java/com/bakdata/conquery/apiv1/frontend/FrontendResultType.java index 4a574dd295..db203da0f2 100644 --- a/backend/src/main/java/com/bakdata/conquery/apiv1/frontend/FrontendResultType.java +++ b/backend/src/main/java/com/bakdata/conquery/apiv1/frontend/FrontendResultType.java @@ -3,13 +3,16 @@ import jakarta.validation.constraints.NotNull; import com.bakdata.conquery.models.types.ResultType; +import lombok.Getter; import lombok.experimental.SuperBuilder; +@Getter @SuperBuilder public class FrontendResultType { @NotNull String type; + @Getter @SuperBuilder public static class List extends FrontendResultType { @NotNull From 06d30b46debbfc943f445a863bd32d364e51d441 Mon Sep 17 00:00:00 2001 From: Max Thonagel <12283268+thoniTUB@users.noreply.github.com> Date: Thu, 12 Sep 2024 13:11:39 +0200 Subject: [PATCH 3/3] don't use typeInfo for list type --- .../com/bakdata/conquery/apiv1/frontend/FrontendResultType.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/main/java/com/bakdata/conquery/apiv1/frontend/FrontendResultType.java b/backend/src/main/java/com/bakdata/conquery/apiv1/frontend/FrontendResultType.java index db203da0f2..22d81d5937 100644 --- a/backend/src/main/java/com/bakdata/conquery/apiv1/frontend/FrontendResultType.java +++ b/backend/src/main/java/com/bakdata/conquery/apiv1/frontend/FrontendResultType.java @@ -23,7 +23,7 @@ public static FrontendResultType from(ResultType resultType) { if (resultType instanceof ResultType.ListT listT) { return List.builder() .elementType(from(listT.getElementType())) - .type(listT.typeInfo()).build(); + .type("LIST").build(); } return FrontendResultType.builder().type(resultType.typeInfo()).build();