Skip to content

Commit

Permalink
feat: appId to productName and ps impl (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
JordenReuter authored Jul 8, 2024
1 parent 5d11f8a commit f80f94f
Show file tree
Hide file tree
Showing 10 changed files with 250 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,22 @@ quarkus.openapi-generator.codegen.spec.onecx_announcement_svc_yaml.base-package=
quarkus.openapi-generator.codegen.spec.onecx_announcement_svc_yaml.return-response=true
quarkus.openapi-generator.codegen.spec.onecx_announcement_svc.additional-api-type-annotations=@org.eclipse.microprofile.rest.client.annotation.RegisterClientHeaders;
quarkus.openapi-generator.codegen.spec.onecx_announcement_svc.additional-model-type-annotations=@io.quarkus.runtime.annotations.RegisterForReflection;
quarkus.openapi-generator.codegen.spec.onecx_announcement_svc_yaml.enable-security-generation=false
quarkus.openapi-generator.codegen.spec.onecx_workspace_svc_v1_yaml.config-key=onecx_workspace_svc_v1
quarkus.openapi-generator.codegen.spec.onecx_workspace_svc_v1_yaml.base-package=gen.org.tkit.onecx.workspace.client
quarkus.openapi-generator.codegen.spec.onecx_workspace_svc_v1_yaml.return-response=true
quarkus.openapi-generator.codegen.spec.onecx_workspace_svc_v1_yaml.additional-api-type-annotations=@org.eclipse.microprofile.rest.client.annotation.RegisterClientHeaders;
quarkus.openapi-generator.codegen.spec.onecx_workspace_svc_v1_yaml.additional-model-type-annotations=@io.quarkus.runtime.annotations.RegisterForReflection;
%prod.quarkus.rest-client.onecx_announcement_svc_yaml.providers=io.quarkus.oidc.client.reactive.filter.OidcClientRequestReactiveFilter
%prod.quarkus.rest-client.onecx_workspace_svc_v1_yaml.providers=io.quarkus.oidc.client.reactive.filter.OidcClientRequestReactiveFilter
quarkus.openapi-generator.codegen.spec.onecx_workspace_svc_v1_yaml.enable-security-generation=false
quarkus.openapi-generator.codegen.spec.onecx_product_store_v1_yaml.config-key=onecx_product_store
quarkus.openapi-generator.codegen.spec.onecx_product_store_v1_yaml.base-package=gen.org.tkit.onecx.product.store
quarkus.openapi-generator.codegen.spec.onecx_product_store_v1_yaml.return-response=true
quarkus.openapi-generator.codegen.spec.onecx_product_store_v1_yaml.additional-api-type-annotations=@org.eclipse.microprofile.rest.client.annotation.RegisterClientHeaders;
quarkus.openapi-generator.codegen.spec.onecx_product_store_v1_yaml.additional-model-type-annotations=@io.quarkus.runtime.annotations.RegisterForReflection;
quarkus.openapi-generator.codegen.spec.onecx_product_store_v1_yaml.enable-security-generation=false
%prod.quarkus.rest-client.onecx_announcement_svc.providers=io.quarkus.oidc.client.reactive.filter.OidcClientRequestReactiveFilter
%prod.quarkus.rest-client.onecx_workspace_svc_v1.providers=io.quarkus.oidc.client.reactive.filter.OidcClientRequestReactiveFilter
%prod.quarkus.rest-client.onecx_product_store.providers=io.quarkus.oidc.client.reactive.filter.OidcClientRequestReactiveFilter
%prod.quarkus.oidc-client.client-id=${quarkus.application.name}
----
====
Expand Down Expand Up @@ -65,8 +74,13 @@ app:
read: permission on all GET requests and POST search
write: permission on PUT, POST, PATCH requests, where objects are saved or updated
delete: permission on all DELETE requests
product:
read: permission on all GET requests and POST search
keycloak:
client:
enabled: true
spec:
kcConfig:
defaultClientScopes: [ ocx-an:all, ocx-ws:read, ocx-pm:read, ocx-ps:read ]
----

Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@ h| Version

| https://quarkus.io/guides/rest[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-rest.adoc[Link]
| 3.11.1
| 3.12.0
| quarkus-smallrye-openapi
| https://quarkus.io/guides/openapi-swaggerui[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-smallrye-openapi.adoc[Link]
| 3.11.1
| 3.12.0
| quarkus-rest-jackson
| https://quarkus.io/guides/rest-json[Link]
|
| 3.11.1
| 3.12.0
| quarkus-smallrye-health
| https://quarkus.io/guides/smallrye-health[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-smallrye-health.adoc[Link]
| 3.11.1
| 3.12.0
| quarkus-openapi-generator
Expand All @@ -42,97 +42,97 @@ h| Version
| https://quarkus.io/guides/rest-client[Link]
|
| 3.11.1
| 3.12.0
| tkit-quarkus-log-cdi
| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-log-cdi.html[Link]
| https://github.com/1000kit/tkit-quarkus/blob/2.25.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-cdi.adoc[Link]
| 2.25.0
| https://github.com/1000kit/tkit-quarkus/blob/2.27.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-cdi.adoc[Link]
| 2.27.0
| tkit-quarkus-log-rs
| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-log-rs.html[Link]
| https://github.com/1000kit/tkit-quarkus/blob/2.25.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-rs.adoc[Link]
| 2.25.0
| https://github.com/1000kit/tkit-quarkus/blob/2.27.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-rs.adoc[Link]
| 2.27.0
| tkit-quarkus-log-json
| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-log-json.html[Link]
| https://github.com/1000kit/tkit-quarkus/blob/2.25.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-json.adoc[Link]
| 2.25.0
| https://github.com/1000kit/tkit-quarkus/blob/2.27.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-json.adoc[Link]
| 2.27.0
| tkit-quarkus-rest
| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-rest.html[Link]
| https://github.com/1000kit/tkit-quarkus/blob/2.25.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-rest.adoc[Link]
| 2.25.0
| https://github.com/1000kit/tkit-quarkus/blob/2.27.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-rest.adoc[Link]
| 2.27.0
| tkit-quarkus-rest-context
| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-rest-context.html[Link]
| https://github.com/1000kit/tkit-quarkus/blob/2.25.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-rest-context.adoc[Link]
| 2.25.0
| https://github.com/1000kit/tkit-quarkus/blob/2.27.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-rest-context.adoc[Link]
| 2.27.0
| quarkus-hibernate-validator
| https://quarkus.io/guides/validation[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-hibernate-validator.adoc[Link]
| 3.11.1
| 3.12.0
| quarkus-opentelemetry
| https://quarkus.io/guides/opentelemetry[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-opentelemetry.adoc[Link]
| 3.11.1
| 3.12.0
| quarkus-micrometer-registry-prometheus
| https://quarkus.io/guides/telemetry-micrometer[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-micrometer-registry-prometheus.adoc[Link]
| 3.11.1
| 3.12.0
| onecx-permissions
| https://onecx.github.io/docs/onecx-quarkus/current/onecx-quarkus/onecx-permissions.html[Link]
| https://github.com/onecx/onecx-quarkus/blob/0.20.0/docs/modules/onecx-quarkus/pages/includes/onecx-permissions.adoc[Link]
| 0.20.0
| https://github.com/onecx/onecx-quarkus/blob/0.22.0/docs/modules/onecx-quarkus/pages/includes/onecx-permissions.adoc[Link]
| 0.22.0
| quarkus-oidc
| https://quarkus.io/guides/security-oidc-bearer-token-authentication-tutorial[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-oidc.adoc[Link]
| 3.11.1
| 3.12.0
| quarkus-oidc-client-reactive-filter
| https://quarkus.io/guides/security-openid-connect-client-reference[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-oidc-client-reactive-filter.adoc[Link]
| 3.11.1
| 3.12.0
| tkit-quarkus-security
| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-security.html[Link]
| https://github.com/1000kit/tkit-quarkus/blob/2.25.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-security.adoc[Link]
| 2.25.0
| https://github.com/1000kit/tkit-quarkus/blob/2.27.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-security.adoc[Link]
| 2.27.0
| onecx-core
| https://onecx.github.io/docs/onecx-quarkus/current/onecx-quarkus/onecx-core.html[Link]
|
| 0.20.0
| 0.22.0
| quarkus-arc
| https://quarkus.io/guides/cdi-reference[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-arc.adoc[Link]
| 3.11.1
| 3.12.0
| quarkus-container-image-docker
| https://quarkus.io/guides/container-image[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-container-image-docker.adoc[Link]
| 3.11.1
| 3.12.0
Expand Down
15 changes: 15 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,21 @@
<skipCache>true</skipCache>
</configuration>
</execution>
<execution>
<id>product-store-v1</id>
<phase>generate-resources</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<uri>
https://raw.githubusercontent.com/onecx/onecx-product-store-svc/main/src/main/openapi/onecx-product-store-v1.yaml
</uri>
<outputDirectory>target/tmp/openapi</outputDirectory>
<outputFileName>onecx-product-store-v1.yaml</outputFileName>
<skipCache>true</skipCache>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Expand Down
4 changes: 3 additions & 1 deletion src/main/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ app:
read: permission on all GET requests and POST search
write: permission on PUT, POST, PATCH requests, where objects are saved or updated
delete: permission on all DELETE requests
product:
read: permission on all GET requests and POST search
keycloak:
client:
enabled: true
spec:
kcConfig:
defaultClientScopes: [ ocx-an:all, ocx-ws:read, ocx-pm:read ]
defaultClientScopes: [ ocx-an:all, ocx-ws:read, ocx-pm:read, ocx-ps:read ]
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import gen.org.tkit.onecx.announcement.bff.rs.internal.model.*;
import gen.org.tkit.onecx.announcement.client.api.AnnouncementInternalApi;
import gen.org.tkit.onecx.announcement.client.model.*;
import gen.org.tkit.onecx.product.store.api.ProductsApi;
import gen.org.tkit.onecx.product.store.model.ProductItemPageResult;
import gen.org.tkit.onecx.workspace.client.api.WorkspaceExternalApi;
import gen.org.tkit.onecx.workspace.client.model.WorkspacePageResult;
import gen.org.tkit.onecx.workspace.client.model.WorkspaceSearchCriteria;
Expand All @@ -37,6 +39,10 @@ public class AnnouncementRestController implements AnnouncementInternalApiServic
@RestClient
WorkspaceExternalApi workspaceClient;

@Inject
@RestClient
ProductsApi productStoreClient;

@Inject
AnnouncementMapper announcementMapper;

Expand All @@ -63,11 +69,11 @@ public Response deleteAnnouncementById(String id) {
}

@Override
public Response getAllAppsWithAnnouncements() {
public Response getAllProductsWithAnnouncements() {

try (Response response = client.getAllAppsWithAnnouncements()) {
AnnouncementApps announcementApps = response.readEntity(AnnouncementApps.class);
return Response.status(response.getStatus()).entity(announcementApps).build();
try (Response response = client.getAllProductsWithAnnouncements()) {
AnnouncementProducts announcementProducts = response.readEntity(AnnouncementProducts.class);
return Response.status(response.getStatus()).entity(announcementProducts).build();
}
}

Expand Down Expand Up @@ -131,6 +137,15 @@ public Response updateAnnouncementById(String id, UpdateAnnouncementRequestDTO u
}
}

@Override
public Response searchProductsByCriteria(ProductsSearchCriteriaDTO productsSearchCriteriaDTO) {
try (Response response = productStoreClient
.searchProductsByCriteria(announcementMapper.map(productsSearchCriteriaDTO))) {
ProductsPageResultDTO products = announcementMapper.map(response.readEntity(ProductItemPageResult.class));
return Response.status(response.getStatus()).entity(products).build();
}
}

@ServerExceptionMapper
public RestResponse<ProblemDetailResponseDTO> constraint(ConstraintViolationException ex) {
return exceptionMapper.constraint(ex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

import gen.org.tkit.onecx.announcement.bff.rs.internal.model.*;
import gen.org.tkit.onecx.announcement.client.model.*;
import gen.org.tkit.onecx.product.store.model.ProductItemPageResult;
import gen.org.tkit.onecx.product.store.model.ProductItemSearchCriteria;
import gen.org.tkit.onecx.workspace.client.model.WorkspaceAbstract;
import gen.org.tkit.onecx.workspace.client.model.WorkspacePageResult;

Expand Down Expand Up @@ -43,7 +45,7 @@ AnnouncementPageResultDTO mapAnnouncementPageResultToAnnouncementPageResultDTO(
@Mapping(target = "endDateTo", ignore = true)
@Mapping(target = "endDateFrom", source = "currentDate")
@Mapping(target = "content", ignore = true)
@Mapping(target = "appId", ignore = true)
@Mapping(target = "productName", ignore = true)
@Mapping(target = "workspaceName", ignore = true)
AnnouncementSearchCriteria mapActiveAnnouncementSearchCriteria(
ActiveAnnouncementsSearchCriteriaDTO activeAnnouncementsSearchCriteriaDTO);
Expand Down Expand Up @@ -103,4 +105,10 @@ default ActiveAnnouncementsPageResultDTO filterAndSort(ActiveAnnouncementsPageRe
}
return pageResult;
}

@Mapping(target = "productNames", ignore = true)
ProductItemSearchCriteria map(ProductsSearchCriteriaDTO productsSearchCriteriaDTO);

@Mapping(target = "removeStreamItem", ignore = true)
ProductsPageResultDTO map(ProductItemPageResult productItemPageResult);
}
Loading

0 comments on commit f80f94f

Please sign in to comment.