From 9f74d92c267123ebf8dd52e24b9eb404152a3c65 Mon Sep 17 00:00:00 2001 From: ikjunoh Date: Mon, 19 Aug 2024 16:32:23 +0900 Subject: [PATCH] =?UTF-8?q?fix=20:=20=EC=B9=B4=EC=B9=B4=EC=98=A4=ED=86=A1?= =?UTF-8?q?=20=EB=AF=B8=EB=A6=AC=EB=B3=B4=EA=B8=B0=20=EC=95=88=EB=90=98?= =?UTF-8?q?=EB=8A=94=20=EB=B2=84=EA=B7=B8=20=ED=95=B4=EA=B2=B0=20(CC-153)?= =?UTF-8?q?=20(#40)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cicd.yml | 2 +- .../domain/request/ShareUrlRequestDto.java | 2 +- .../shorturl/service/ShortUrlService.java | 18 ++++++++++++------ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index d5919df..fa8619c 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -59,5 +59,5 @@ jobs: script: | sudo docker rm -f $(docker ps -qa) sudo docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_IMAGE }} - sudo docker run -d -p 8080:8080 ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_IMAGE }} + sudo docker run -d -p 80:8080 ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_IMAGE }} sudo docker image prune -f diff --git a/src/main/java/ai/softeer/caecae/shorturl/domain/request/ShareUrlRequestDto.java b/src/main/java/ai/softeer/caecae/shorturl/domain/request/ShareUrlRequestDto.java index f3b12ea..1dfbc3d 100644 --- a/src/main/java/ai/softeer/caecae/shorturl/domain/request/ShareUrlRequestDto.java +++ b/src/main/java/ai/softeer/caecae/shorturl/domain/request/ShareUrlRequestDto.java @@ -2,6 +2,6 @@ public record ShareUrlRequestDto( double distance, - int percentage + double percentage ) { } diff --git a/src/main/java/ai/softeer/caecae/shorturl/service/ShortUrlService.java b/src/main/java/ai/softeer/caecae/shorturl/service/ShortUrlService.java index 51fcfe3..9767d77 100644 --- a/src/main/java/ai/softeer/caecae/shorturl/service/ShortUrlService.java +++ b/src/main/java/ai/softeer/caecae/shorturl/service/ShortUrlService.java @@ -33,7 +33,7 @@ public class ShortUrlService { @Transactional public ShareUrlResponseDto shareUrl(ShareUrlRequestDto req) { double distance = Math.round(req.distance() * 1e6) / 1e6; // 소수점 6자리까지만 반영 - int percentage = req.percentage(); + double percentage = Math.round(req.percentage() * 1e2) / 1e2; if (distance > 400.0 || percentage > 100) throw new UrlException(ErrorCode.BAD_REQUEST); String longUrl = "/api/url/preview?distance=" + distance + "&percentage=" + percentage; @@ -96,12 +96,18 @@ public ResponseEntity shortUrlToLongUrl(String shortUrl) { */ public ResponseEntity previewUrl(ShareUrlRequestDto req) { return ResponseEntity.status(200) + .header("Content-Type", "text/html; charset=utf-8") .body( - "" + - "" + - "" + - "" + - "" + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" ); } } \ No newline at end of file