From 674075daa6d90737d6cbaf77bf803d5850847556 Mon Sep 17 00:00:00 2001 From: nnijgnus Date: Sat, 24 Aug 2024 01:01:30 +0900 Subject: [PATCH 1/5] =?UTF-8?q?refactor:=20RequestDto=20->=20request?= =?UTF-8?q?=EB=A1=9C=20=ED=8C=A8=ED=82=A4=EC=A7=80=20=EC=9D=B4=EB=A6=84=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/adminController/AdminController.java | 6 +++--- .../eventController/LotteryEventController.java | 4 ++-- .../dto/{RequestDto => request}/AdminRequestDto.java | 2 +- .../lotteryEventDto/CasperBotRequestDto.java | 2 +- .../lotteryEventDto/LotteryEventRequestDto.java | 2 +- .../rushEventDto/RushEventOptionRequestDto.java | 2 +- .../rushEventDto/RushEventRequestDto.java | 2 +- .../domain/event/entity/casperBot/CasperBot.java | 2 +- .../domain/event/entity/event/RushEvent.java | 2 +- .../domain/event/entity/event/RushOption.java | 2 +- .../event/service/adminService/AdminService.java | 8 ++++---- .../service/eventService/LotteryEventService.java | 2 +- .../global/jwt/filter/VerifyAdminFilter.java | 2 +- .../adminController/AdminControllerTest.java | 10 +++++----- .../eventController/LotteryEventControllerTest.java | 2 +- .../event/service/adminService/AdminServiceTest.java | 10 +++++----- .../service/eventService/LotteryEventServiceTest.java | 6 +++--- 17 files changed, 33 insertions(+), 33 deletions(-) rename Server/src/main/java/JGS/CasperEvent/domain/event/dto/{RequestDto => request}/AdminRequestDto.java (90%) rename Server/src/main/java/JGS/CasperEvent/domain/event/dto/{RequestDto => request}/lotteryEventDto/CasperBotRequestDto.java (97%) rename Server/src/main/java/JGS/CasperEvent/domain/event/dto/{RequestDto => request}/lotteryEventDto/LotteryEventRequestDto.java (94%) rename Server/src/main/java/JGS/CasperEvent/domain/event/dto/{RequestDto => request}/rushEventDto/RushEventOptionRequestDto.java (96%) rename Server/src/main/java/JGS/CasperEvent/domain/event/dto/{RequestDto => request}/rushEventDto/RushEventRequestDto.java (97%) diff --git a/Server/src/main/java/JGS/CasperEvent/domain/event/controller/adminController/AdminController.java b/Server/src/main/java/JGS/CasperEvent/domain/event/controller/adminController/AdminController.java index 092a7b50..9fb05af1 100644 --- a/Server/src/main/java/JGS/CasperEvent/domain/event/controller/adminController/AdminController.java +++ b/Server/src/main/java/JGS/CasperEvent/domain/event/controller/adminController/AdminController.java @@ -1,8 +1,8 @@ package JGS.CasperEvent.domain.event.controller.adminController; -import JGS.CasperEvent.domain.event.dto.RequestDto.AdminRequestDto; -import JGS.CasperEvent.domain.event.dto.RequestDto.lotteryEventDto.LotteryEventRequestDto; -import JGS.CasperEvent.domain.event.dto.RequestDto.rushEventDto.RushEventRequestDto; +import JGS.CasperEvent.domain.event.dto.request.AdminRequestDto; +import JGS.CasperEvent.domain.event.dto.request.lotteryEventDto.LotteryEventRequestDto; +import JGS.CasperEvent.domain.event.dto.request.rushEventDto.RushEventRequestDto; import JGS.CasperEvent.domain.event.dto.response.ImageUrlResponseDto; import JGS.CasperEvent.domain.event.dto.response.ParticipantsListResponseDto; import JGS.CasperEvent.domain.event.dto.response.lottery.ExpectationsPagingResponseDto; diff --git a/Server/src/main/java/JGS/CasperEvent/domain/event/controller/eventController/LotteryEventController.java b/Server/src/main/java/JGS/CasperEvent/domain/event/controller/eventController/LotteryEventController.java index 2541844d..53afd790 100644 --- a/Server/src/main/java/JGS/CasperEvent/domain/event/controller/eventController/LotteryEventController.java +++ b/Server/src/main/java/JGS/CasperEvent/domain/event/controller/eventController/LotteryEventController.java @@ -1,6 +1,6 @@ package JGS.CasperEvent.domain.event.controller.eventController; -import JGS.CasperEvent.domain.event.dto.RequestDto.lotteryEventDto.CasperBotRequestDto; +import JGS.CasperEvent.domain.event.dto.request.lotteryEventDto.CasperBotRequestDto; import JGS.CasperEvent.domain.event.dto.response.lottery.CasperBotResponseDto; import JGS.CasperEvent.domain.event.dto.response.lottery.LotteryEventParticipantResponseDto; import JGS.CasperEvent.domain.event.dto.response.lottery.LotteryEventResponseDto; @@ -61,7 +61,7 @@ public ResponseEntity getLotteryEvent() { @PostMapping("/casperBot") public ResponseEntity postCasperBot( HttpServletRequest request, - @RequestBody @Valid CasperBotRequestDto postCasperBot) throws NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException { + @RequestBody @Valid CasperBotRequestDto postCasperBot) { BaseUser user = (BaseUser) request.getAttribute("user"); return ResponseEntity .status(HttpStatus.CREATED) 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/request/AdminRequestDto.java similarity index 90% rename from Server/src/main/java/JGS/CasperEvent/domain/event/dto/RequestDto/AdminRequestDto.java rename to Server/src/main/java/JGS/CasperEvent/domain/event/dto/request/AdminRequestDto.java index 77605025..9c0ae770 100644 --- a/Server/src/main/java/JGS/CasperEvent/domain/event/dto/RequestDto/AdminRequestDto.java +++ b/Server/src/main/java/JGS/CasperEvent/domain/event/dto/request/AdminRequestDto.java @@ -1,4 +1,4 @@ -package JGS.CasperEvent.domain.event.dto.RequestDto; +package JGS.CasperEvent.domain.event.dto.request; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotNull; diff --git a/Server/src/main/java/JGS/CasperEvent/domain/event/dto/RequestDto/lotteryEventDto/CasperBotRequestDto.java b/Server/src/main/java/JGS/CasperEvent/domain/event/dto/request/lotteryEventDto/CasperBotRequestDto.java similarity index 97% rename from Server/src/main/java/JGS/CasperEvent/domain/event/dto/RequestDto/lotteryEventDto/CasperBotRequestDto.java rename to Server/src/main/java/JGS/CasperEvent/domain/event/dto/request/lotteryEventDto/CasperBotRequestDto.java index d7125f45..7698a6c3 100644 --- a/Server/src/main/java/JGS/CasperEvent/domain/event/dto/RequestDto/lotteryEventDto/CasperBotRequestDto.java +++ b/Server/src/main/java/JGS/CasperEvent/domain/event/dto/request/lotteryEventDto/CasperBotRequestDto.java @@ -1,4 +1,4 @@ -package JGS.CasperEvent.domain.event.dto.RequestDto.lotteryEventDto; +package JGS.CasperEvent.domain.event.dto.request.lotteryEventDto; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.Max; diff --git a/Server/src/main/java/JGS/CasperEvent/domain/event/dto/RequestDto/lotteryEventDto/LotteryEventRequestDto.java b/Server/src/main/java/JGS/CasperEvent/domain/event/dto/request/lotteryEventDto/LotteryEventRequestDto.java similarity index 94% rename from Server/src/main/java/JGS/CasperEvent/domain/event/dto/RequestDto/lotteryEventDto/LotteryEventRequestDto.java rename to Server/src/main/java/JGS/CasperEvent/domain/event/dto/request/lotteryEventDto/LotteryEventRequestDto.java index 334778b8..31ffceea 100644 --- a/Server/src/main/java/JGS/CasperEvent/domain/event/dto/RequestDto/lotteryEventDto/LotteryEventRequestDto.java +++ b/Server/src/main/java/JGS/CasperEvent/domain/event/dto/request/lotteryEventDto/LotteryEventRequestDto.java @@ -1,4 +1,4 @@ -package JGS.CasperEvent.domain.event.dto.RequestDto.lotteryEventDto; +package JGS.CasperEvent.domain.event.dto.request.lotteryEventDto; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotNull; diff --git a/Server/src/main/java/JGS/CasperEvent/domain/event/dto/RequestDto/rushEventDto/RushEventOptionRequestDto.java b/Server/src/main/java/JGS/CasperEvent/domain/event/dto/request/rushEventDto/RushEventOptionRequestDto.java similarity index 96% rename from Server/src/main/java/JGS/CasperEvent/domain/event/dto/RequestDto/rushEventDto/RushEventOptionRequestDto.java rename to Server/src/main/java/JGS/CasperEvent/domain/event/dto/request/rushEventDto/RushEventOptionRequestDto.java index d27a670a..9e9451af 100644 --- a/Server/src/main/java/JGS/CasperEvent/domain/event/dto/RequestDto/rushEventDto/RushEventOptionRequestDto.java +++ b/Server/src/main/java/JGS/CasperEvent/domain/event/dto/request/rushEventDto/RushEventOptionRequestDto.java @@ -1,4 +1,4 @@ -package JGS.CasperEvent.domain.event.dto.RequestDto.rushEventDto; +package JGS.CasperEvent.domain.event.dto.request.rushEventDto; import io.swagger.v3.oas.annotations.media.Schema; import JGS.CasperEvent.global.enums.Position; diff --git a/Server/src/main/java/JGS/CasperEvent/domain/event/dto/RequestDto/rushEventDto/RushEventRequestDto.java b/Server/src/main/java/JGS/CasperEvent/domain/event/dto/request/rushEventDto/RushEventRequestDto.java similarity index 97% rename from Server/src/main/java/JGS/CasperEvent/domain/event/dto/RequestDto/rushEventDto/RushEventRequestDto.java rename to Server/src/main/java/JGS/CasperEvent/domain/event/dto/request/rushEventDto/RushEventRequestDto.java index 170e4605..93b1ed7d 100644 --- a/Server/src/main/java/JGS/CasperEvent/domain/event/dto/RequestDto/rushEventDto/RushEventRequestDto.java +++ b/Server/src/main/java/JGS/CasperEvent/domain/event/dto/request/rushEventDto/RushEventRequestDto.java @@ -1,4 +1,4 @@ -package JGS.CasperEvent.domain.event.dto.RequestDto.rushEventDto; +package JGS.CasperEvent.domain.event.dto.request.rushEventDto; import io.swagger.v3.oas.annotations.media.Schema; import JGS.CasperEvent.global.enums.CustomErrorCode; diff --git a/Server/src/main/java/JGS/CasperEvent/domain/event/entity/casperBot/CasperBot.java b/Server/src/main/java/JGS/CasperEvent/domain/event/entity/casperBot/CasperBot.java index ec7d232e..18f26a44 100644 --- a/Server/src/main/java/JGS/CasperEvent/domain/event/entity/casperBot/CasperBot.java +++ b/Server/src/main/java/JGS/CasperEvent/domain/event/entity/casperBot/CasperBot.java @@ -1,6 +1,6 @@ package JGS.CasperEvent.domain.event.entity.casperBot; -import JGS.CasperEvent.domain.event.dto.RequestDto.lotteryEventDto.CasperBotRequestDto; +import JGS.CasperEvent.domain.event.dto.request.lotteryEventDto.CasperBotRequestDto; import JGS.CasperEvent.global.entity.BaseEntity; import jakarta.persistence.*; import lombok.EqualsAndHashCode; diff --git a/Server/src/main/java/JGS/CasperEvent/domain/event/entity/event/RushEvent.java b/Server/src/main/java/JGS/CasperEvent/domain/event/entity/event/RushEvent.java index ed199812..bdc7d545 100644 --- a/Server/src/main/java/JGS/CasperEvent/domain/event/entity/event/RushEvent.java +++ b/Server/src/main/java/JGS/CasperEvent/domain/event/entity/event/RushEvent.java @@ -1,6 +1,6 @@ package JGS.CasperEvent.domain.event.entity.event; -import JGS.CasperEvent.domain.event.dto.RequestDto.rushEventDto.RushEventRequestDto; +import JGS.CasperEvent.domain.event.dto.request.rushEventDto.RushEventRequestDto; import JGS.CasperEvent.domain.event.entity.participants.RushParticipants; import JGS.CasperEvent.global.enums.CustomErrorCode; import JGS.CasperEvent.global.enums.Position; diff --git a/Server/src/main/java/JGS/CasperEvent/domain/event/entity/event/RushOption.java b/Server/src/main/java/JGS/CasperEvent/domain/event/entity/event/RushOption.java index c241c827..a9fe43ce 100644 --- a/Server/src/main/java/JGS/CasperEvent/domain/event/entity/event/RushOption.java +++ b/Server/src/main/java/JGS/CasperEvent/domain/event/entity/event/RushOption.java @@ -1,6 +1,6 @@ package JGS.CasperEvent.domain.event.entity.event; -import JGS.CasperEvent.domain.event.dto.RequestDto.rushEventDto.RushEventOptionRequestDto; +import JGS.CasperEvent.domain.event.dto.request.rushEventDto.RushEventOptionRequestDto; import JGS.CasperEvent.global.entity.BaseEntity; import JGS.CasperEvent.global.enums.Position; import com.fasterxml.jackson.annotation.JsonBackReference; diff --git a/Server/src/main/java/JGS/CasperEvent/domain/event/service/adminService/AdminService.java b/Server/src/main/java/JGS/CasperEvent/domain/event/service/adminService/AdminService.java index ee05b55a..a612bad1 100644 --- a/Server/src/main/java/JGS/CasperEvent/domain/event/service/adminService/AdminService.java +++ b/Server/src/main/java/JGS/CasperEvent/domain/event/service/adminService/AdminService.java @@ -1,9 +1,9 @@ package JGS.CasperEvent.domain.event.service.adminService; -import JGS.CasperEvent.domain.event.dto.RequestDto.AdminRequestDto; -import JGS.CasperEvent.domain.event.dto.RequestDto.lotteryEventDto.LotteryEventRequestDto; -import JGS.CasperEvent.domain.event.dto.RequestDto.rushEventDto.RushEventOptionRequestDto; -import JGS.CasperEvent.domain.event.dto.RequestDto.rushEventDto.RushEventRequestDto; +import JGS.CasperEvent.domain.event.dto.request.AdminRequestDto; +import JGS.CasperEvent.domain.event.dto.request.lotteryEventDto.LotteryEventRequestDto; +import JGS.CasperEvent.domain.event.dto.request.rushEventDto.RushEventOptionRequestDto; +import JGS.CasperEvent.domain.event.dto.request.rushEventDto.RushEventRequestDto; import JGS.CasperEvent.domain.event.dto.response.ImageUrlResponseDto; import JGS.CasperEvent.domain.event.dto.response.ParticipantsListResponseDto; import JGS.CasperEvent.domain.event.dto.response.lottery.CasperBotResponseDto; diff --git a/Server/src/main/java/JGS/CasperEvent/domain/event/service/eventService/LotteryEventService.java b/Server/src/main/java/JGS/CasperEvent/domain/event/service/eventService/LotteryEventService.java index f58d22a8..9918e477 100644 --- a/Server/src/main/java/JGS/CasperEvent/domain/event/service/eventService/LotteryEventService.java +++ b/Server/src/main/java/JGS/CasperEvent/domain/event/service/eventService/LotteryEventService.java @@ -1,6 +1,6 @@ package JGS.CasperEvent.domain.event.service.eventService; -import JGS.CasperEvent.domain.event.dto.RequestDto.lotteryEventDto.CasperBotRequestDto; +import JGS.CasperEvent.domain.event.dto.request.lotteryEventDto.CasperBotRequestDto; import JGS.CasperEvent.domain.event.dto.response.lottery.CasperBotResponseDto; import JGS.CasperEvent.domain.event.dto.response.lottery.LotteryEventParticipantResponseDto; import JGS.CasperEvent.domain.event.dto.response.lottery.LotteryEventResponseDto; diff --git a/Server/src/main/java/JGS/CasperEvent/global/jwt/filter/VerifyAdminFilter.java b/Server/src/main/java/JGS/CasperEvent/global/jwt/filter/VerifyAdminFilter.java index 19d97a11..bbfbb73c 100644 --- a/Server/src/main/java/JGS/CasperEvent/global/jwt/filter/VerifyAdminFilter.java +++ b/Server/src/main/java/JGS/CasperEvent/global/jwt/filter/VerifyAdminFilter.java @@ -1,6 +1,6 @@ package JGS.CasperEvent.global.jwt.filter; -import JGS.CasperEvent.domain.event.dto.RequestDto.AdminRequestDto; +import JGS.CasperEvent.domain.event.dto.request.AdminRequestDto; import JGS.CasperEvent.domain.event.entity.admin.Admin; import JGS.CasperEvent.domain.event.service.adminService.AdminService; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/Server/src/test/java/JGS/CasperEvent/domain/event/controller/adminController/AdminControllerTest.java b/Server/src/test/java/JGS/CasperEvent/domain/event/controller/adminController/AdminControllerTest.java index 1f738ff7..d5ec4204 100644 --- a/Server/src/test/java/JGS/CasperEvent/domain/event/controller/adminController/AdminControllerTest.java +++ b/Server/src/test/java/JGS/CasperEvent/domain/event/controller/adminController/AdminControllerTest.java @@ -1,10 +1,10 @@ package JGS.CasperEvent.domain.event.controller.adminController; -import JGS.CasperEvent.domain.event.dto.RequestDto.AdminRequestDto; -import JGS.CasperEvent.domain.event.dto.RequestDto.lotteryEventDto.CasperBotRequestDto; -import JGS.CasperEvent.domain.event.dto.RequestDto.lotteryEventDto.LotteryEventRequestDto; -import JGS.CasperEvent.domain.event.dto.RequestDto.rushEventDto.RushEventOptionRequestDto; -import JGS.CasperEvent.domain.event.dto.RequestDto.rushEventDto.RushEventRequestDto; +import JGS.CasperEvent.domain.event.dto.request.AdminRequestDto; +import JGS.CasperEvent.domain.event.dto.request.lotteryEventDto.CasperBotRequestDto; +import JGS.CasperEvent.domain.event.dto.request.lotteryEventDto.LotteryEventRequestDto; +import JGS.CasperEvent.domain.event.dto.request.rushEventDto.RushEventOptionRequestDto; +import JGS.CasperEvent.domain.event.dto.request.rushEventDto.RushEventRequestDto; import JGS.CasperEvent.domain.event.dto.response.ImageUrlResponseDto; import JGS.CasperEvent.domain.event.dto.response.ParticipantsListResponseDto; import JGS.CasperEvent.domain.event.dto.response.lottery.ExpectationsPagingResponseDto; diff --git a/Server/src/test/java/JGS/CasperEvent/domain/event/controller/eventController/LotteryEventControllerTest.java b/Server/src/test/java/JGS/CasperEvent/domain/event/controller/eventController/LotteryEventControllerTest.java index 6766b72b..54875995 100644 --- a/Server/src/test/java/JGS/CasperEvent/domain/event/controller/eventController/LotteryEventControllerTest.java +++ b/Server/src/test/java/JGS/CasperEvent/domain/event/controller/eventController/LotteryEventControllerTest.java @@ -1,6 +1,6 @@ package JGS.CasperEvent.domain.event.controller.eventController; -import JGS.CasperEvent.domain.event.dto.RequestDto.lotteryEventDto.CasperBotRequestDto; +import JGS.CasperEvent.domain.event.dto.request.lotteryEventDto.CasperBotRequestDto; import JGS.CasperEvent.domain.event.dto.response.lottery.CasperBotResponseDto; import JGS.CasperEvent.domain.event.dto.response.lottery.LotteryEventParticipantResponseDto; import JGS.CasperEvent.domain.event.dto.response.lottery.LotteryEventResponseDto; diff --git a/Server/src/test/java/JGS/CasperEvent/domain/event/service/adminService/AdminServiceTest.java b/Server/src/test/java/JGS/CasperEvent/domain/event/service/adminService/AdminServiceTest.java index 64a1da72..fc310d1f 100644 --- a/Server/src/test/java/JGS/CasperEvent/domain/event/service/adminService/AdminServiceTest.java +++ b/Server/src/test/java/JGS/CasperEvent/domain/event/service/adminService/AdminServiceTest.java @@ -1,10 +1,10 @@ package JGS.CasperEvent.domain.event.service.adminService; -import JGS.CasperEvent.domain.event.dto.RequestDto.AdminRequestDto; -import JGS.CasperEvent.domain.event.dto.RequestDto.lotteryEventDto.CasperBotRequestDto; -import JGS.CasperEvent.domain.event.dto.RequestDto.lotteryEventDto.LotteryEventRequestDto; -import JGS.CasperEvent.domain.event.dto.RequestDto.rushEventDto.RushEventOptionRequestDto; -import JGS.CasperEvent.domain.event.dto.RequestDto.rushEventDto.RushEventRequestDto; +import JGS.CasperEvent.domain.event.dto.request.AdminRequestDto; +import JGS.CasperEvent.domain.event.dto.request.lotteryEventDto.CasperBotRequestDto; +import JGS.CasperEvent.domain.event.dto.request.lotteryEventDto.LotteryEventRequestDto; +import JGS.CasperEvent.domain.event.dto.request.rushEventDto.RushEventOptionRequestDto; +import JGS.CasperEvent.domain.event.dto.request.rushEventDto.RushEventRequestDto; import JGS.CasperEvent.domain.event.dto.response.ImageUrlResponseDto; import JGS.CasperEvent.domain.event.dto.response.ParticipantsListResponseDto; import JGS.CasperEvent.domain.event.dto.response.lottery.CasperBotResponseDto; diff --git a/Server/src/test/java/JGS/CasperEvent/domain/event/service/eventService/LotteryEventServiceTest.java b/Server/src/test/java/JGS/CasperEvent/domain/event/service/eventService/LotteryEventServiceTest.java index c6d39c12..d38d2b16 100644 --- a/Server/src/test/java/JGS/CasperEvent/domain/event/service/eventService/LotteryEventServiceTest.java +++ b/Server/src/test/java/JGS/CasperEvent/domain/event/service/eventService/LotteryEventServiceTest.java @@ -1,6 +1,6 @@ package JGS.CasperEvent.domain.event.service.eventService; -import JGS.CasperEvent.domain.event.dto.RequestDto.lotteryEventDto.CasperBotRequestDto; +import JGS.CasperEvent.domain.event.dto.request.lotteryEventDto.CasperBotRequestDto; import JGS.CasperEvent.domain.event.dto.response.lottery.CasperBotResponseDto; import JGS.CasperEvent.domain.event.dto.response.lottery.LotteryEventParticipantResponseDto; import JGS.CasperEvent.domain.event.dto.response.lottery.LotteryEventResponseDto; @@ -65,7 +65,7 @@ class LotteryEventServiceTest { private CasperBot casperBot; @BeforeEach - void setUp() { + void setUp() { byte[] decodedKey = "I0EM1X1NeXKJv4Q+ifZllg==".getBytes(); SecretKey secretKey = new SecretKeySpec(decodedKey, 0, decodedKey.length, "AES"); ReflectionTestUtils.setField(lotteryEventService, "secretKey", secretKey); @@ -100,7 +100,7 @@ void setUp() { @Test @DisplayName("캐스퍼 봇 등록 테스트 - 성공") - void postCasperBot_Success() throws NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException { + void postCasperBot_Success() { //given given(casperBotRepository.save(casperBot)).willReturn(casperBot); given(eventCacheService.getLotteryEvent()).willReturn(lotteryEvent); From 451990ea8c94ed6cb1fffc8c12bd26b482142bc6 Mon Sep 17 00:00:00 2001 From: nnijgnus Date: Sat, 24 Aug 2024 01:35:28 +0900 Subject: [PATCH 2/5] =?UTF-8?q?refactor:=20totalAppliedCount=20=ED=95=84?= =?UTF-8?q?=EB=93=9C=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CasperEvent/domain/event/entity/event/BaseEvent.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Server/src/main/java/JGS/CasperEvent/domain/event/entity/event/BaseEvent.java b/Server/src/main/java/JGS/CasperEvent/domain/event/entity/event/BaseEvent.java index 9ebf46fc..343295c5 100644 --- a/Server/src/main/java/JGS/CasperEvent/domain/event/entity/event/BaseEvent.java +++ b/Server/src/main/java/JGS/CasperEvent/domain/event/entity/event/BaseEvent.java @@ -23,14 +23,12 @@ public class BaseEvent extends BaseEntity { @JsonDeserialize(using = LocalDateTimeDeserializer.class) protected LocalDateTime endDateTime; protected int winnerCount; - protected int totalAppliedCount; // 기본 생성자에서 디폴트 값 설정 public BaseEvent() { this.startDateTime = LocalDateTime.now(); this.endDateTime = LocalDateTime.now().plusMinutes(10); this.winnerCount = 0; // 기본 우승자 수를 0으로 설정 - this.totalAppliedCount = 0; } // 특정 값을 설정할 수 있는 생성자 @@ -38,10 +36,5 @@ public BaseEvent(LocalDateTime startDateTime, LocalDateTime endDateTime, int win this.startDateTime = startDateTime; this.endDateTime = endDateTime; this.winnerCount = winnerCount; - this.totalAppliedCount = 0; - } - - public void addAppliedCount() { - this.totalAppliedCount++; } } From 4373e510fd0830f1c1e90b90c53f38bba4ada99a Mon Sep 17 00:00:00 2001 From: nnijgnus Date: Sat, 24 Aug 2024 01:35:43 +0900 Subject: [PATCH 3/5] =?UTF-8?q?refactor:=20withDetail=20=ED=8C=8C=EB=9D=BC?= =?UTF-8?q?=EB=AF=B8=ED=84=B0=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/lottery/LotteryEventResponseDto.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Server/src/main/java/JGS/CasperEvent/domain/event/dto/response/lottery/LotteryEventResponseDto.java b/Server/src/main/java/JGS/CasperEvent/domain/event/dto/response/lottery/LotteryEventResponseDto.java index 2a8af8bf..41394bb4 100644 --- a/Server/src/main/java/JGS/CasperEvent/domain/event/dto/response/lottery/LotteryEventResponseDto.java +++ b/Server/src/main/java/JGS/CasperEvent/domain/event/dto/response/lottery/LotteryEventResponseDto.java @@ -27,7 +27,7 @@ public class LotteryEventResponseDto { private EventStatus status; - private int appliedCount; + private Long appliedCount; private Long activePeriod; private Long casperId; @@ -58,7 +58,7 @@ public static LotteryEventResponseDto of(LotteryEvent lotteryEvent, LocalDateTim private LotteryEventResponseDto(LocalDate startDate, LocalTime startTime, LocalDate endDate, LocalTime endTime, - int appliedCount, int winnerCount, + Long appliedCount, int winnerCount, EventStatus status, LocalDateTime createdAt, LocalDateTime updatedAt) { this.startDate = startDate; @@ -72,7 +72,7 @@ private LotteryEventResponseDto(LocalDate startDate, LocalTime startTime, this.updatedAt = updatedAt; } - public static LotteryEventResponseDto withDetail(LotteryEvent event) { + public static LotteryEventResponseDto withDetail(LotteryEvent event, Long appliedCount) { EventStatus status; LocalDateTime now = LocalDateTime.now(); @@ -85,7 +85,7 @@ public static LotteryEventResponseDto withDetail(LotteryEvent event) { event.getStartDateTime().toLocalTime(), event.getEndDateTime().toLocalDate(), event.getEndDateTime().toLocalTime(), - event.getTotalAppliedCount(), + appliedCount, event.getWinnerCount(), status, event.getCreatedAt(), From b823e653c6e8079aff569c30b2fb8409a1bccaa7 Mon Sep 17 00:00:00 2001 From: nnijgnus Date: Sat, 24 Aug 2024 01:36:13 +0900 Subject: [PATCH 4/5] =?UTF-8?q?feat:=20=EC=B6=94=EC=B2=A8=20=EC=9D=B8?= =?UTF-8?q?=EC=9B=90=20=EC=88=98=20=EB=8D=B0=EC=9D=B4=ED=84=B0=EB=B2=A0?= =?UTF-8?q?=EC=9D=B4=EC=8A=A4=EC=97=90=EC=84=9C=20=EC=A1=B0=ED=9A=8C?= =?UTF-8?q?=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=A1=9C=EC=A7=81=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/event/service/adminService/AdminService.java | 6 ++++-- .../event/service/eventService/LotteryEventService.java | 8 +++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Server/src/main/java/JGS/CasperEvent/domain/event/service/adminService/AdminService.java b/Server/src/main/java/JGS/CasperEvent/domain/event/service/adminService/AdminService.java index a612bad1..01e49b1d 100644 --- a/Server/src/main/java/JGS/CasperEvent/domain/event/service/adminService/AdminService.java +++ b/Server/src/main/java/JGS/CasperEvent/domain/event/service/adminService/AdminService.java @@ -106,7 +106,8 @@ public LotteryEventResponseDto createLotteryEvent(LotteryEventRequestDto lottery // 추첨 이벤트 조회 public LotteryEventResponseDto getLotteryEvent() { - return LotteryEventResponseDto.withDetail(getCurrentLotteryEvent()); + long appliedCount = lotteryParticipantsRepository.count(); + return LotteryEventResponseDto.withDetail(getCurrentLotteryEvent(), appliedCount); } // 추첨 이벤트 참여자 조회 @@ -318,7 +319,8 @@ else if (newStartDateTime.isBefore(now)) { // 필드 업데이트 currentLotteryEvent.updateLotteryEvent(newStartDateTime, newEndDateTime, lotteryEventRequestDto.getWinnerCount()); eventCacheService.setLotteryEvent(); - return LotteryEventResponseDto.withDetail(currentLotteryEvent); + Long appliedCount = lotteryParticipantsRepository.count(); + return LotteryEventResponseDto.withDetail(currentLotteryEvent, appliedCount); } // 추첨 이벤트 조회 diff --git a/Server/src/main/java/JGS/CasperEvent/domain/event/service/eventService/LotteryEventService.java b/Server/src/main/java/JGS/CasperEvent/domain/event/service/eventService/LotteryEventService.java index 9918e477..9b47915d 100644 --- a/Server/src/main/java/JGS/CasperEvent/domain/event/service/eventService/LotteryEventService.java +++ b/Server/src/main/java/JGS/CasperEvent/domain/event/service/eventService/LotteryEventService.java @@ -42,10 +42,9 @@ public class LotteryEventService { public CasperBotResponseDto postCasperBot(BaseUser user, CasperBotRequestDto casperBotRequestDto) throws CustomException { LotteryEvent lotteryEvent = eventCacheService.getLotteryEvent(); - LotteryParticipants participants = registerUserIfNeed(lotteryEvent, user, casperBotRequestDto); + LotteryParticipants participants = registerUserIfNeed(user, casperBotRequestDto); CasperBot casperBot = casperBotRepository.save(new CasperBot(casperBotRequestDto, user.getPhoneNumber())); - lotteryEvent.addAppliedCount(); participants.updateCasperId(casperBot.getCasperId()); @@ -74,15 +73,14 @@ public CasperBotResponseDto getCasperBot(Long casperId) { } - public LotteryParticipants registerUserIfNeed(LotteryEvent lotteryEvent, BaseUser user, CasperBotRequestDto casperBotRequestDto) { + public LotteryParticipants registerUserIfNeed(BaseUser user, CasperBotRequestDto casperBotRequestDto) { LotteryParticipants participant = lotteryParticipantsRepository.findByBaseUser(user).orElse(null); if (participant == null) { participant = new LotteryParticipants(user); lotteryParticipantsRepository.save(participant); - addReferralAppliedCount(casperBotRequestDto); - } else lotteryEvent.addAppliedCount(); + } return participant; } From 25cba11af698eb26f7e1006de0177284c5da9add Mon Sep 17 00:00:00 2001 From: nnijgnus Date: Sat, 24 Aug 2024 01:36:24 +0900 Subject: [PATCH 5/5] =?UTF-8?q?feat:=20=EB=B0=94=EB=80=90=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=EB=A1=9C=EC=A7=81=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/adminController/AdminControllerTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Server/src/test/java/JGS/CasperEvent/domain/event/controller/adminController/AdminControllerTest.java b/Server/src/test/java/JGS/CasperEvent/domain/event/controller/adminController/AdminControllerTest.java index d5ec4204..c90e3341 100644 --- a/Server/src/test/java/JGS/CasperEvent/domain/event/controller/adminController/AdminControllerTest.java +++ b/Server/src/test/java/JGS/CasperEvent/domain/event/controller/adminController/AdminControllerTest.java @@ -162,7 +162,7 @@ void setUp() throws Exception { this.lotteryEventParticipantsListResponseDto = new ParticipantsListResponseDto<>(participants, true, 1); // 추첨 이벤트 상세 응답 DTO - lotteryEventDetailResponseDto = LotteryEventResponseDto.withDetail(lotteryEvent); + lotteryEventDetailResponseDto = LotteryEventResponseDto.withDetail(lotteryEvent, 1L); // 캐스퍼 봇 casperBotRequestDto = CasperBotRequestDto.builder() @@ -321,7 +321,7 @@ void postImageSuccessTest() throws Exception { @DisplayName("추첨 이벤트 조회 성공 테스트") void getLotteryEventSuccessTest() throws Exception { //given - given(adminService.getLotteryEvent()).willReturn(LotteryEventResponseDto.withDetail(lotteryEvent)); + given(adminService.getLotteryEvent()).willReturn(LotteryEventResponseDto.withDetail(lotteryEvent, 1L)); //when ResultActions perform = mockMvc.perform(get("/admin/event/lottery").header("Authorization", accessToken).contentType(APPLICATION_JSON)); @@ -332,7 +332,7 @@ void getLotteryEventSuccessTest() throws Exception { .andExpect(jsonPath("$.startTime").value("00:00:00")) .andExpect(jsonPath("$.endDate").value("2100-09-27")) .andExpect(jsonPath("$.endTime").value("00:00:00")) - .andExpect(jsonPath("$.appliedCount").value(0)) + .andExpect(jsonPath("$.appliedCount").value(1L)) .andExpect(jsonPath("$.winnerCount").value(315)) .andExpect(jsonPath("$.status").value("DURING")) .andDo(print()); @@ -619,7 +619,7 @@ void updateLotteryEventSuccessTest() throws Exception { .andExpect(jsonPath("$.startTime").value("00:00:00")) .andExpect(jsonPath("$.endDate").value("2100-09-27")) .andExpect(jsonPath("$.endTime").value("00:00:00")) - .andExpect(jsonPath("$.appliedCount").value(0)) + .andExpect(jsonPath("$.appliedCount").value(1L)) .andExpect(jsonPath("$.winnerCount").value(315)) .andExpect(jsonPath("$.status").value("DURING")) .andDo(print());