Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: refactoring, migration org.tkit #6

Merged
merged 4 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ jobs:
uses: onecx/ci-quarkus/.github/workflows/build.yml@v1
secrets: inherit
with:
helmEventTargetRepository: onecx/onecx-theme
helmEventTargetRepository: onecx/onecx-help

9 changes: 9 additions & 0 deletions .github/workflows/create-new-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Create new build

on:
workflow_dispatch:

jobs:
build:
uses: onecx/ci-common/.github/workflows/create-new-build.yml@v1
secrets: inherit
26 changes: 17 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.github.onecx</groupId>
<groupId>org.tkit.onecx</groupId>
<artifactId>onecx-quarkus3-parent</artifactId>
<version>0.25.0</version>
<version>0.31.0</version>
</parent>

<artifactId>onecx-help-bff</artifactId>
Expand All @@ -25,10 +25,6 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-health</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.openapi.generator</groupId>
<artifactId>quarkus-openapi-generator</artifactId>
Expand Down Expand Up @@ -56,7 +52,7 @@
</dependency>
<dependency>
<groupId>org.tkit.quarkus.lib</groupId>
<artifactId>tkit-quarkus-jpa</artifactId>
<artifactId>tkit-quarkus-rest-context</artifactId>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
Expand All @@ -78,6 +74,18 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-micrometer-registry-prometheus</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-oidc</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-oidc-client</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-oidc-client-reactive-filter</artifactId>
</dependency>
<!-- DEV -->
<dependency>
<groupId>io.quarkiverse.mockserver</groupId>
Expand Down Expand Up @@ -117,8 +125,8 @@
</goals>
<configuration>
<inputSpec>src/main/openapi/openapi-help-bff.yaml</inputSpec>
<apiPackage>gen.io.github.onecx.help.bff.rs.internal</apiPackage>
<modelPackage>gen.io.github.onecx.help.bff.rs.internal.model</modelPackage>
<apiPackage>gen.org.tkit.onecx.help.bff.rs.internal</apiPackage>
<modelPackage>gen.org.tkit.onecx.help.bff.rs.internal.model</modelPackage>
</configuration>
</execution>
</executions>
Expand Down
6 changes: 3 additions & 3 deletions src/main/helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apiVersion: v2
name: onecx-helm-bff
name: onecx-help-bff
version: 0.0.0
appVersion: 0.0.0
description: Onecx helm bff
description: Onecx help bff
keywords:
- iam
- parameters
sources:
- https://github.com/onecx/onecx-helm-bff
- https://github.com/onecx/onecx-help-bff
maintainers:
- name: Tkit Developer
email: [email protected]
Expand Down
6 changes: 2 additions & 4 deletions src/main/helm/values.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
app:
name: bff
image:
repository: "onecx/onecx-announcement-bff"
tag: 999-SNAPSHOT
db:
enabled: true
repository: "onecx/onecx-help-bff"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.onecx.help.bff.rs.controller;
package org.tkit.onecx.help.bff.rs.controller;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
Expand All @@ -10,18 +10,18 @@
import org.eclipse.microprofile.rest.client.inject.RestClient;
import org.jboss.resteasy.reactive.RestResponse;
import org.jboss.resteasy.reactive.server.ServerExceptionMapper;
import org.tkit.onecx.help.bff.rs.mappers.ExceptionMapper;
import org.tkit.onecx.help.bff.rs.mappers.HelpMapper;
import org.tkit.onecx.help.bff.rs.mappers.ProblemDetailMapper;
import org.tkit.quarkus.log.cdi.LogService;

import gen.io.github.onecx.help.bff.clients.api.HelpsInternalApi;
import gen.io.github.onecx.help.bff.clients.model.Help;
import gen.io.github.onecx.help.bff.clients.model.HelpAppIds;
import gen.io.github.onecx.help.bff.clients.model.HelpPageResult;
import gen.io.github.onecx.help.bff.clients.model.ProblemDetailResponse;
import gen.io.github.onecx.help.bff.rs.internal.HelpsInternalApiService;
import gen.io.github.onecx.help.bff.rs.internal.model.*;
import io.github.onecx.help.bff.rs.mappers.ExceptionMapper;
import io.github.onecx.help.bff.rs.mappers.HelpMapper;
import io.github.onecx.help.bff.rs.mappers.ProblemDetailMapper;
import gen.org.tkit.onecx.help.bff.clients.api.HelpsInternalApi;
import gen.org.tkit.onecx.help.bff.clients.model.Help;
import gen.org.tkit.onecx.help.bff.clients.model.HelpAppIds;
import gen.org.tkit.onecx.help.bff.clients.model.HelpPageResult;
import gen.org.tkit.onecx.help.bff.clients.model.ProblemDetailResponse;
import gen.org.tkit.onecx.help.bff.rs.internal.HelpsInternalApiService;
import gen.org.tkit.onecx.help.bff.rs.internal.model.*;

@ApplicationScoped
@Transactional(value = Transactional.TxType.NOT_SUPPORTED)
Expand Down Expand Up @@ -78,24 +78,6 @@ public Response getHelpById(String id) {
}
}

@Override
public Response getHelpByItemId(String itemId) {
try (Response response = client.getHelpByItemId(itemId)) {
Help help = response.readEntity(Help.class);
HelpDTO helpDTO = helpMapper.mapHelp(help);
return Response.status(response.getStatus()).entity(helpDTO).build();
}
}

@Override
public Response getHelps(Integer pageNumber, Integer pageSize) {
try (Response response = client.getHelps(pageNumber, pageSize)) {
HelpPageResult helpPageResult = response.readEntity(HelpPageResult.class);
HelpPageResultDTO helpPageResultDTO = helpMapper.mapHelpPageResults(helpPageResult);
return Response.status(response.getStatus()).entity(helpPageResultDTO).build();
}
}

@Override
public Response searchHelps(HelpSearchCriteriaDTO helpSearchCriteriaDTO) {

Expand All @@ -118,13 +100,11 @@ public Response updateHelp(String id, UpdateHelpDTO updateHelpDTO) {

@ServerExceptionMapper
public RestResponse<ProblemDetailResponseDTO> constraint(ConstraintViolationException ex) {

return exceptionMapper.constraint(ex);
}

@ServerExceptionMapper
public Response restException(WebApplicationException ex) {

return Response.status(ex.getResponse().getStatus()).build();
}
}
30 changes: 30 additions & 0 deletions src/main/java/org/tkit/onecx/help/bff/rs/log/BffLogParam.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.tkit.onecx.help.bff.rs.log;

import gen.org.tkit.onecx.help.bff.rs.internal.model.*;
import jakarta.enterprise.context.ApplicationScoped;
import org.tkit.quarkus.log.cdi.LogParam;

import java.util.List;

@ApplicationScoped
public class BffLogParam implements LogParam {

@Override
public List<Item> getClasses() {
return List.of(
item(10, CreateHelpDTO.class, x -> {
CreateHelpDTO d = (CreateHelpDTO) x;
return CreateHelpDTO.class.getSimpleName() + "[" + d.getAppId() + "," + d.getItemId() + "]";
}),
item(10, UpdateHelpDTO.class, x -> {
UpdateHelpDTO d = (UpdateHelpDTO) x;
return UpdateHelpDTO.class.getSimpleName() + "[" + d.getAppId() + "," + d.getItemId() + "]";
}),
item(10, HelpSearchCriteriaDTO.class, x -> {
HelpSearchCriteriaDTO d = (HelpSearchCriteriaDTO) x;
return HelpSearchCriteriaDTO.class.getSimpleName() + "[" + d.getPageNumber() + ","
+ d.getPageSize()
+ "]";
}));
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.onecx.help.bff.rs.mappers;
package org.tkit.onecx.help.bff.rs.mappers;

import java.util.List;
import java.util.Map;
Expand All @@ -14,9 +14,9 @@
import org.mapstruct.Mapping;
import org.tkit.quarkus.rs.mappers.OffsetDateTimeMapper;

import gen.io.github.onecx.help.bff.rs.internal.model.ProblemDetailInvalidParamDTO;
import gen.io.github.onecx.help.bff.rs.internal.model.ProblemDetailParamDTO;
import gen.io.github.onecx.help.bff.rs.internal.model.ProblemDetailResponseDTO;
import gen.org.tkit.onecx.help.bff.rs.internal.model.ProblemDetailInvalidParamDTO;
import gen.org.tkit.onecx.help.bff.rs.internal.model.ProblemDetailParamDTO;
import gen.org.tkit.onecx.help.bff.rs.internal.model.ProblemDetailResponseDTO;

@Mapper(uses = { OffsetDateTimeMapper.class })
public interface ExceptionMapper {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package io.github.onecx.help.bff.rs.mappers;
package org.tkit.onecx.help.bff.rs.mappers;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.tkit.quarkus.rs.mappers.OffsetDateTimeMapper;

import gen.io.github.onecx.help.bff.clients.model.*;
import gen.io.github.onecx.help.bff.rs.internal.model.*;
import gen.org.tkit.onecx.help.bff.clients.model.*;
import gen.org.tkit.onecx.help.bff.rs.internal.model.*;

@Mapper(uses = { OffsetDateTimeMapper.class })
public interface HelpMapper {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package io.github.onecx.help.bff.rs.mappers;
package org.tkit.onecx.help.bff.rs.mappers;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.tkit.quarkus.rs.mappers.OffsetDateTimeMapper;

import gen.io.github.onecx.help.bff.clients.model.ProblemDetailResponse;
import gen.io.github.onecx.help.bff.rs.internal.model.ProblemDetailResponseDTO;
import gen.org.tkit.onecx.help.bff.clients.model.ProblemDetailResponse;
import gen.org.tkit.onecx.help.bff.rs.internal.model.ProblemDetailResponseDTO;

@Mapper(uses = { OffsetDateTimeMapper.class })
public interface ProblemDetailMapper {
Expand Down
76 changes: 4 additions & 72 deletions src/main/openapi/openapi-help-bff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,6 @@ tags:
- name: helpsInternal
paths:
/helps:
get:
tags:
- helpsInternal
description: Return list of helps
operationId: getHelps
parameters:
- name: pageNumber
in: query
schema:
format: int32
description: The number of page.
default: 0
type: integer
- name: pageSize
in: query
schema:
format: int32
description: The size of page
default: 10
type: integer
responses:
"200":
description: OK
content:
application/json:
schema:
items:
$ref: '#/components/schemas/HelpPageResult'
post:
tags:
- helpsInternal
Expand Down Expand Up @@ -162,27 +134,6 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/HelpPageResult'
/helps/itemId/{itemId}:
get:
tags:
- helpsInternal
description: Load a single help definition
operationId: getHelpByItemId
parameters:
- name: itemId
in: path
required: true
schema:
type: string
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Help'
"404":
description: Not found
components:
schemas:
HelpSearchCriteria:
Expand Down Expand Up @@ -233,7 +184,7 @@ components:
- itemId
type: object
properties:
version:
modificationCount:
format: int32
type: integer
creationDate:
Expand Down Expand Up @@ -294,19 +245,6 @@ components:
- itemId
type: object
properties:
version:
format: int32
type: integer
creationDate:
$ref: '#/components/schemas/OffsetDateTime'
creationUser:
type: string
modificationDate:
$ref: '#/components/schemas/OffsetDateTime'
modificationUser:
type: string
id:
type: string
itemId:
type: string
context:
Expand All @@ -320,19 +258,13 @@ components:
UpdateHelp:
required:
- name
- itemId
- modificationCount
type: object
properties:
version:
modificationCount:
format: int32
type: integer
creationDate:
$ref: '#/components/schemas/OffsetDateTime'
creationUser:
type: string
modificationDate:
$ref: '#/components/schemas/OffsetDateTime'
modificationUser:
type: string
id:
type: string
itemId:
Expand Down
Loading
Loading