From 61d614fda3f98d098d34d8c06ed56be8fccd73f0 Mon Sep 17 00:00:00 2001 From: nnijgnus Date: Tue, 20 Aug 2024 14:18:45 +0900 Subject: [PATCH 1/3] =?UTF-8?q?chore:=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=98=A4=ED=83=88=EC=9E=90=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 --- .../controller/eventController/RushEventControllerTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 b1ad19e4..4cfcca58 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 @@ -249,7 +249,7 @@ public void getRushEventResultTest() throws Exception { .andExpect(jsonPath("$.rightOption").value(1000)) .andExpect(jsonPath("$.rank").value(1)) .andExpect(jsonPath("$.totalParticipants").value(1000)) - .andExpect(jsonPath("$.winner").value(true)) + .andExpect(jsonPath("$.isWinner").value(true)) .andDo(print()); } From 527cd1a7098bfa8a35ce5fddd8d7434cc23c30da Mon Sep 17 00:00:00 2001 From: nnijgnus Date: Tue, 20 Aug 2024 14:19:12 +0900 Subject: [PATCH 2/3] =?UTF-8?q?docs:=20=EC=B6=94=EC=B2=A8=20=EC=9D=B4?= =?UTF-8?q?=EB=B2=A4=ED=8A=B8=20Swagger=20=EC=9D=B4=EC=9A=A9=ED=95=B4=20?= =?UTF-8?q?=EB=AC=B8=EC=84=9C=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LotteryEventController.java | 31 ++++++++++++++++--- 1 file changed, 26 insertions(+), 5 deletions(-) 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 8223063a..f116d15d 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 @@ -7,6 +7,10 @@ import JGS.CasperEvent.domain.event.service.redisService.RedisService; import JGS.CasperEvent.domain.event.service.eventService.LotteryEventService; import JGS.CasperEvent.global.entity.BaseUser; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.parameters.RequestBody; import jakarta.servlet.http.HttpServletRequest; import jakarta.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; @@ -35,15 +39,25 @@ public LotteryEventController(LotteryEventService lotteryEventService, RedisServ this.redisService = redisService; } - // 추첨 이벤트 조회 API + @Operation(summary = "추첨 이벤트 조회", description = "현재 진행 중인 추첨 이벤트의 정보를 조회합니다.") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Lottery event retrieval successful"), + @ApiResponse(responseCode = "404", description = "No lottery event found in the database"), + @ApiResponse(responseCode = "409", description = "More than one lottery event exists in the database") + }) @GetMapping - public ResponseEntity getLotteryEvent(){ + public ResponseEntity getLotteryEvent() { return ResponseEntity .status(HttpStatus.OK) .body(lotteryEventService.getLotteryEvent()); } - // 캐스퍼 봇 생성 API + @Operation(summary = "캐스퍼 봇 생성", description = "새로운 캐스퍼 봇을 생성합니다.") + @ApiResponses(value = { + @ApiResponse(responseCode = "201", description = "Casper bot creation successful"), + @ApiResponse(responseCode = "404", description = "No lottery event found in the database"), + @ApiResponse(responseCode = "409", description = "More than one lottery event exists in the database") + }) @PostMapping("/casperBot") public ResponseEntity postCasperBot( HttpServletRequest request, @@ -54,7 +68,11 @@ public ResponseEntity postCasperBot( .body(lotteryEventService.postCasperBot(user, postCasperBot)); } - // 응모 여부 조회 API + @Operation(summary = "응모 여부 조회", description = "현재 사용자의 응모 여부를 조회합니다.") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Application status retrieval successful"), + @ApiResponse(responseCode = "404", description = "User has not applied") + }) @GetMapping("/applied") public ResponseEntity GetLotteryParticipant(HttpServletRequest request) throws UserPrincipalNotFoundException { BaseUser user = (BaseUser) request.getAttribute("user"); @@ -63,7 +81,10 @@ public ResponseEntity GetLotteryParticipant(HttpS .body(lotteryEventService.getLotteryParticipant(user)); } - // 최근 100개 캐스퍼 봇 조회 + @Operation(summary = "최근 100개 캐스퍼 봇 조회", description = "최근에 생성된 100개의 캐스퍼 봇을 조회합니다.") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Recent Casper bots retrieval successful") + }) @GetMapping("/caspers") public ResponseEntity> getCasperBots() { return ResponseEntity.status(HttpStatus.OK) From c64d4facf40347da2bcd1baf10c0173a3e5395bd Mon Sep 17 00:00:00 2001 From: nnijgnus Date: Tue, 20 Aug 2024 14:47:32 +0900 Subject: [PATCH 3/3] =?UTF-8?q?docs:=20Tag=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../event/controller/adminController/AdminController.java | 2 ++ .../controller/eventController/LotteryEventController.java | 3 ++- .../controller/eventController/LotteryEventControllerTest.java | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) 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 6cc17096..0fb47ba4 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 @@ -14,6 +14,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; @@ -23,6 +24,7 @@ import java.util.List; +@Tag(name = "관리자 API", description = "관리자 관련 API 목록입니다.") @RestController @RequestMapping("/admin") @RequiredArgsConstructor 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 f116d15d..fcf7cb3c 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 @@ -10,7 +10,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; -import io.swagger.v3.oas.annotations.parameters.RequestBody; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletRequest; import jakarta.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; @@ -26,6 +26,7 @@ import java.security.NoSuchAlgorithmException; import java.util.List; +@Tag(name = "추첨 이벤트 API", description = "추첨 이벤트 (Lottery Event) 관련 API 목록입니다.") @RestController @RequestMapping("/event/lottery") public class LotteryEventController { 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 4cf07d8e..2fd50db1 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 @@ -93,7 +93,8 @@ void setUp() throws Exception { .sticker(0) .name("name") .expectation("expectation") - .referralId("QEszP1K8IqcapUHAVwikXA==").build(); + .referralId("QEszP1K8IqcapUHAVwikXA==") + .build(); casperBot = new CasperBot(casperBotRequest, "010-0000-0000");