From 7a6d6055f17f1bba99f5dba768a06b23ac319fa9 Mon Sep 17 00:00:00 2001 From: dankito Date: Mon, 10 Apr 2023 20:10:23 +0200 Subject: [PATCH] Removed -Dto suffix from DTOs --- .../epcqrcode/rest/EpcQrCodeResource.kt | 27 +++++++++---------- ...uestDto.kt => GenerateEpcQrCodeRequest.kt} | 2 +- ...nseDto.kt => GenerateEpcQrCodeResponse.kt} | 2 +- 3 files changed, 14 insertions(+), 17 deletions(-) rename EpcQrCodeRest/src/main/kotlin/net/codinux/banking/epcqrcode/rest/dto/{GenerateEpcQrCodeRequestDto.kt => GenerateEpcQrCodeRequest.kt} (98%) rename EpcQrCodeRest/src/main/kotlin/net/codinux/banking/epcqrcode/rest/dto/{GenerateEpcQrCodeResponseDto.kt => GenerateEpcQrCodeResponse.kt} (88%) diff --git a/EpcQrCodeRest/src/main/kotlin/net/codinux/banking/epcqrcode/rest/EpcQrCodeResource.kt b/EpcQrCodeRest/src/main/kotlin/net/codinux/banking/epcqrcode/rest/EpcQrCodeResource.kt index 4e261b9..cbca111 100644 --- a/EpcQrCodeRest/src/main/kotlin/net/codinux/banking/epcqrcode/rest/EpcQrCodeResource.kt +++ b/EpcQrCodeRest/src/main/kotlin/net/codinux/banking/epcqrcode/rest/EpcQrCodeResource.kt @@ -2,8 +2,8 @@ package net.codinux.banking.epcqrcode.rest import net.codinux.banking.epcqrcode.EpcQrCodeConfig import net.codinux.banking.epcqrcode.EpcQrCodeGenerator -import net.codinux.banking.epcqrcode.rest.dto.GenerateEpcQrCodeRequestDto -import net.codinux.banking.epcqrcode.rest.dto.GenerateEpcQrCodeResponseDto +import net.codinux.banking.epcqrcode.rest.dto.GenerateEpcQrCodeRequest +import net.codinux.banking.epcqrcode.rest.dto.GenerateEpcQrCodeResponse import org.eclipse.microprofile.openapi.annotations.Operation import org.eclipse.microprofile.openapi.annotations.media.Content import org.eclipse.microprofile.openapi.annotations.media.Schema @@ -21,42 +21,39 @@ import javax.ws.rs.core.Response @Tag(name = "EPC QR Code") class EpcQrCodeResource { - companion object { - private val log = LoggerFactory.getLogger(EpcQrCodeResource::class.java) - } - - protected val epcQrCodeGenerator = EpcQrCodeGenerator() + private val log = LoggerFactory.getLogger(EpcQrCodeResource::class.java) + @Operation(summary = "Creates a EPC QR code (also marketed as GiroCode, scan2Code, ...)") @APIResponse(responseCode = "200", description = "The generated EPC QR Code", - content = [ Content(mediaType = "application/json", schema = Schema(implementation = GenerateEpcQrCodeResponseDto::class)) ]) + content = [ Content(mediaType = "application/json", schema = Schema(implementation = GenerateEpcQrCodeResponse::class)) ]) @APIResponse(responseCode = "500", description = "An internal error occurred") @GET - fun createEpcQrCodeGet(@BeanParam request: GenerateEpcQrCodeRequestDto): Response { + fun createEpcQrCodeGet(@BeanParam request: GenerateEpcQrCodeRequest): Response { return handleJsonRequest(request) } @Operation(summary = "Creates a EPC QR code (also marketed as GiroCode, scan2Code, ...)") @APIResponse(responseCode = "200", description = "The generated EPC QR Code", - content = [ Content(mediaType = "application/json", schema = Schema(implementation = GenerateEpcQrCodeResponseDto::class)) ]) + content = [ Content(mediaType = "application/json", schema = Schema(implementation = GenerateEpcQrCodeResponse::class)) ]) @APIResponse(responseCode = "500", description = "An internal error occurred") @POST @Consumes(MediaType.APPLICATION_JSON) fun createEpcQrCodePost( - @RequestBody(content = [ Content(schema = Schema(implementation = GenerateEpcQrCodeRequestDto::class)) ]) - request: GenerateEpcQrCodeRequestDto + @RequestBody(content = [ Content(schema = Schema(implementation = GenerateEpcQrCodeRequest::class)) ]) + request: GenerateEpcQrCodeRequest ): Response { return handleJsonRequest(request) } - private fun handleJsonRequest(request: GenerateEpcQrCodeRequestDto): Response { + private fun handleJsonRequest(request: GenerateEpcQrCodeRequest): Response { try { val epcQrCode = epcQrCodeGenerator.generateEpcQrCode(mapToEpcQrCodeConfig(request), request.imageHeightAndWidth) val qrCodeBytes = epcQrCode.bytes // TODO: convert to Base64 - return Response.ok(GenerateEpcQrCodeResponseDto(qrCodeBytes)) + return Response.ok(GenerateEpcQrCodeResponse(qrCodeBytes)) .header("Access-Control-Allow-Origin", "*") .build() } catch (e: Exception) { @@ -68,7 +65,7 @@ class EpcQrCodeResource { } } - private fun mapToEpcQrCodeConfig(dto: GenerateEpcQrCodeRequestDto): EpcQrCodeConfig { + private fun mapToEpcQrCodeConfig(dto: GenerateEpcQrCodeRequest): EpcQrCodeConfig { return EpcQrCodeConfig( dto.receiverName, dto.iban, diff --git a/EpcQrCodeRest/src/main/kotlin/net/codinux/banking/epcqrcode/rest/dto/GenerateEpcQrCodeRequestDto.kt b/EpcQrCodeRest/src/main/kotlin/net/codinux/banking/epcqrcode/rest/dto/GenerateEpcQrCodeRequest.kt similarity index 98% rename from EpcQrCodeRest/src/main/kotlin/net/codinux/banking/epcqrcode/rest/dto/GenerateEpcQrCodeRequestDto.kt rename to EpcQrCodeRest/src/main/kotlin/net/codinux/banking/epcqrcode/rest/dto/GenerateEpcQrCodeRequest.kt index d776e23..9c04d4b 100644 --- a/EpcQrCodeRest/src/main/kotlin/net/codinux/banking/epcqrcode/rest/dto/GenerateEpcQrCodeRequestDto.kt +++ b/EpcQrCodeRest/src/main/kotlin/net/codinux/banking/epcqrcode/rest/dto/GenerateEpcQrCodeRequest.kt @@ -9,7 +9,7 @@ import javax.ws.rs.DefaultValue import javax.ws.rs.QueryParam -class GenerateEpcQrCodeRequestDto { +class GenerateEpcQrCodeRequest { @QueryParam("receiverName") @Parameter(description = "The name of the receiver of this money transfer (that is in most cases your name or your company's name)", required = true) diff --git a/EpcQrCodeRest/src/main/kotlin/net/codinux/banking/epcqrcode/rest/dto/GenerateEpcQrCodeResponseDto.kt b/EpcQrCodeRest/src/main/kotlin/net/codinux/banking/epcqrcode/rest/dto/GenerateEpcQrCodeResponse.kt similarity index 88% rename from EpcQrCodeRest/src/main/kotlin/net/codinux/banking/epcqrcode/rest/dto/GenerateEpcQrCodeResponseDto.kt rename to EpcQrCodeRest/src/main/kotlin/net/codinux/banking/epcqrcode/rest/dto/GenerateEpcQrCodeResponse.kt index 9e5021f..23a1e41 100644 --- a/EpcQrCodeRest/src/main/kotlin/net/codinux/banking/epcqrcode/rest/dto/GenerateEpcQrCodeResponseDto.kt +++ b/EpcQrCodeRest/src/main/kotlin/net/codinux/banking/epcqrcode/rest/dto/GenerateEpcQrCodeResponse.kt @@ -3,7 +3,7 @@ package net.codinux.banking.epcqrcode.rest.dto import org.eclipse.microprofile.openapi.annotations.media.Schema -class GenerateEpcQrCodeResponseDto( +class GenerateEpcQrCodeResponse( // JAX-RS automatically encodes ByteArray to Base64 @Schema(description = "The Base64 encoded generated EPC QR Code") val qrCodeBase64Encoded: ByteArray