From 926b8d91ade868f9c8c39a6f2af107552ec18eec Mon Sep 17 00:00:00 2001 From: wjddn2165 Date: Tue, 20 Aug 2024 18:25:20 +0900 Subject: [PATCH 1/3] =?UTF-8?q?chore:=20import=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/event/dto/RequestDto/AdminRequestDto.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Server/src/main/java/JGS/CasperEvent/domain/event/dto/RequestDto/AdminRequestDto.java b/Server/src/main/java/JGS/CasperEvent/domain/event/dto/RequestDto/AdminRequestDto.java index 7bef51f5..6e3cf015 100644 --- a/Server/src/main/java/JGS/CasperEvent/domain/event/dto/RequestDto/AdminRequestDto.java +++ b/Server/src/main/java/JGS/CasperEvent/domain/event/dto/RequestDto/AdminRequestDto.java @@ -1,9 +1,7 @@ package JGS.CasperEvent.domain.event.dto.RequestDto; import jakarta.validation.constraints.NotNull; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; +import lombok.*; @Getter @Builder From 01698de50969264f6bbeae6aa975db88da7b6378 Mon Sep 17 00:00:00 2001 From: wjddn2165 Date: Tue, 20 Aug 2024 18:25:53 +0900 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=EB=A1=9C=EA=B7=B8=20=EC=A0=80?= =?UTF-8?q?=EC=9E=A5=ED=95=A0=20=EB=95=8C=20=EB=A1=9C=EA=B7=B8=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=EC=9D=B4=2010MB=20=EB=A7=88=EB=8B=A4=20=EB=A1=A4?= =?UTF-8?q?=EB=A7=81=EB=90=98=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD,=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=20=EC=9A=A9=EB=9F=89=EC=9D=B4=20=EC=B5=9C?= =?UTF-8?q?=EB=8C=80=201GB=EB=A5=BC=20=EB=84=98=EC=9D=84=20=EC=88=98=20?= =?UTF-8?q?=EC=97=86=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Server/src/main/resources/logback-spring.xml | 92 ++------------------ 1 file changed, 8 insertions(+), 84 deletions(-) diff --git a/Server/src/main/resources/logback-spring.xml b/Server/src/main/resources/logback-spring.xml index db964357..677222e1 100644 --- a/Server/src/main/resources/logback-spring.xml +++ b/Server/src/main/resources/logback-spring.xml @@ -1,5 +1,4 @@ - @@ -11,58 +10,21 @@ ./logs/info.log - - ./logs/info.%d{yyyy-MM-dd}.log - 30 - - - %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg [%X{requestId}]%n - - - INFO - ACCEPT - DENY - - - - - ./logs/error.log - - ./logs/error.%d{yyyy-MM-dd}.log - 30 - - - %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg [%X{requestId}]%n - - - ERROR - ACCEPT - DENY - - - - - ./logs/warn.log - - ./logs/warn.%d{yyyy-MM-dd}.log + + ./logs/info.%d{yyyy-MM-dd}.%i.log.gz + 10MB 30 + 1GB %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg [%X{requestId}]%n - - WARN - ACCEPT - DENY - - - @@ -70,59 +32,21 @@ /logs/info.log - - /logs/info.%d{yyyy-MM-dd}.log + + /logs/info.%d{yyyy-MM-dd}.%i.log.gz + 10MB 30 + 1GB %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg [%X{requestId}]%n - - INFO - ACCEPT - DENY - - - - - /logs/error.log - - /logs/error.%d{yyyy-MM-dd}.log - 30 - - - %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg [%X{requestId}]%n - - - ERROR - ACCEPT - DENY - - - - - /logs/warn.log - - /logs/warn.%d{yyyy-MM-dd}.log - 30 - - - %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg [%X{requestId}]%n - - - WARN - ACCEPT - DENY - - - - From bc6f74872a6221b88dec649806a6e49f0eca78b6 Mon Sep 17 00:00:00 2001 From: wjddn2165 Date: Tue, 20 Aug 2024 18:40:12 +0900 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=EC=84=A0=EC=B0=A9=EC=88=9C=20?= =?UTF-8?q?=EC=9D=B4=EB=B2=A4=ED=8A=B8=20=EA=B2=B0=EA=B3=BC=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20API=EC=97=90=20optionId=20=ED=95=84=EB=93=9C=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RushEventResultResponseDto.java | 1 + .../event/service/eventService/RushEventService.java | 12 +++++++----- .../eventController/RushEventControllerTest.java | 2 ++ .../service/eventService/RushEventServiceTest.java | 5 +++++ 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Server/src/main/java/JGS/CasperEvent/domain/event/dto/ResponseDto/rushEventResponseDto/RushEventResultResponseDto.java b/Server/src/main/java/JGS/CasperEvent/domain/event/dto/ResponseDto/rushEventResponseDto/RushEventResultResponseDto.java index 5bad44f4..8f0a41be 100644 --- a/Server/src/main/java/JGS/CasperEvent/domain/event/dto/ResponseDto/rushEventResponseDto/RushEventResultResponseDto.java +++ b/Server/src/main/java/JGS/CasperEvent/domain/event/dto/ResponseDto/rushEventResponseDto/RushEventResultResponseDto.java @@ -6,6 +6,7 @@ @Getter @AllArgsConstructor public class RushEventResultResponseDto { + private final Integer optionId; private final Long leftOption; private final Long rightOption; private final Long rank; diff --git a/Server/src/main/java/JGS/CasperEvent/domain/event/service/eventService/RushEventService.java b/Server/src/main/java/JGS/CasperEvent/domain/event/service/eventService/RushEventService.java index eea618e3..ae2dc171 100644 --- a/Server/src/main/java/JGS/CasperEvent/domain/event/service/eventService/RushEventService.java +++ b/Server/src/main/java/JGS/CasperEvent/domain/event/service/eventService/RushEventService.java @@ -115,6 +115,7 @@ public RushEventResultResponseDto getRushEventResult(BaseUser user) { Optional optionIdOptional = rushParticipantsRepository.getOptionIdByUserId(user.getId()); if (optionIdOptional.isEmpty()) { return new RushEventResultResponseDto( + null, leftOption, rightOption, null, @@ -123,6 +124,9 @@ public RushEventResultResponseDto getRushEventResult(BaseUser user) { ); } + // optionId 를 꺼냄 + int optionId = optionIdOptional.get(); + // 동점인 경우 if (leftOption == rightOption) { // 전체 참여자에서 등수 계산하기 @@ -134,11 +138,9 @@ public RushEventResultResponseDto getRushEventResult(BaseUser user) { // 당첨 여부 boolean isWinner = rank <= todayRushEvent.winnerCount(); - return new RushEventResultResponseDto(leftOption, rightOption, rank, totalParticipants, isWinner); + return new RushEventResultResponseDto(optionId, leftOption, rightOption, rank, totalParticipants, isWinner); } - int optionId = optionIdOptional.get(); - long totalParticipants = (optionId == 1 ? leftOption : rightOption); // eventId, userId, optionId 를 이용하여 해당 유저가 응모한 선택지에서 등수를 가져옴 @@ -146,13 +148,13 @@ public RushEventResultResponseDto getRushEventResult(BaseUser user) { // 해당 유저가 선택한 옵션이 패배한 경우 if ((optionId == 1 && leftOption < rightOption) || (optionId == 2 && leftOption > rightOption)) { - return new RushEventResultResponseDto(leftOption, rightOption, rank, totalParticipants, false); + return new RushEventResultResponseDto(optionId, leftOption, rightOption, rank, totalParticipants, false); } // 당첨 여부 boolean isWinner = rank <= todayRushEvent.winnerCount(); - return new RushEventResultResponseDto(leftOption, rightOption, rank, totalParticipants, isWinner); + return new RushEventResultResponseDto(optionId, leftOption, rightOption, rank, totalParticipants, isWinner); } // 오늘의 이벤트를 DB에 꺼내서 반환 diff --git a/Server/src/test/java/JGS/CasperEvent/domain/event/controller/eventController/RushEventControllerTest.java b/Server/src/test/java/JGS/CasperEvent/domain/event/controller/eventController/RushEventControllerTest.java index 4cfcca58..9d76cc87 100644 --- a/Server/src/test/java/JGS/CasperEvent/domain/event/controller/eventController/RushEventControllerTest.java +++ b/Server/src/test/java/JGS/CasperEvent/domain/event/controller/eventController/RushEventControllerTest.java @@ -111,6 +111,7 @@ void setUp() throws Exception { given(rushEventService.getRushEventRate(any())).willReturn(rushEventRateResponseDto); RushEventResultResponseDto rushEventResultResponseDto = new RushEventResultResponseDto( + 1, 315L, 1000L, 1L, @@ -245,6 +246,7 @@ public void getRushEventResultTest() throws Exception { // then perform.andExpect(status().isOk()) + .andExpect(jsonPath("$.optionId").value(1)) .andExpect(jsonPath("$.leftOption").value(315)) .andExpect(jsonPath("$.rightOption").value(1000)) .andExpect(jsonPath("$.rank").value(1)) diff --git a/Server/src/test/java/JGS/CasperEvent/domain/event/service/eventService/RushEventServiceTest.java b/Server/src/test/java/JGS/CasperEvent/domain/event/service/eventService/RushEventServiceTest.java index 6af99fda..058ceaf4 100644 --- a/Server/src/test/java/JGS/CasperEvent/domain/event/service/eventService/RushEventServiceTest.java +++ b/Server/src/test/java/JGS/CasperEvent/domain/event/service/eventService/RushEventServiceTest.java @@ -224,6 +224,7 @@ void getRushEventResult() { // then assertNotNull(result); + assertEquals(1, result.getOptionId()); assertEquals(700, result.getLeftOption()); assertEquals(500, result.getRightOption()); assertEquals(700, result.getTotalParticipants()); @@ -258,6 +259,7 @@ void getRushEventResult2() { // then assertNotNull(result); + assertEquals(2, result.getOptionId()); assertEquals(700, result.getLeftOption()); assertEquals(500, result.getRightOption()); assertEquals(500, result.getTotalParticipants()); @@ -292,6 +294,7 @@ void getRushEventResult3() { // then assertNotNull(result); + assertEquals(1, result.getOptionId()); assertEquals(700, result.getLeftOption()); assertEquals(500, result.getRightOption()); assertEquals(700, result.getTotalParticipants()); @@ -325,6 +328,7 @@ void getRushEventResult4() { // then assertNotNull(result); + assertEquals(1, result.getOptionId()); assertEquals(500, result.getLeftOption()); assertEquals(500, result.getRightOption()); assertEquals(1000, result.getTotalParticipants()); @@ -358,6 +362,7 @@ void getRushEventResult5() { // then assertNotNull(result); + assertEquals(1, result.getOptionId()); assertEquals(500, result.getLeftOption()); assertEquals(500, result.getRightOption()); assertEquals(1000, result.getTotalParticipants());