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 8223063a..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 @@ -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.tags.Tag; import jakarta.servlet.http.HttpServletRequest; import jakarta.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; @@ -22,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 { @@ -35,15 +40,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 +69,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 +82,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) 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"); 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()); }