From 2d962ea129fd1d97dfebbf0248ecd29dedc3e2c3 Mon Sep 17 00:00:00 2001 From: yxhwxn Date: Sat, 10 Aug 2024 03:37:25 +0900 Subject: [PATCH] =?UTF-8?q?Refactor:=20=EC=A1=B0=EA=B1=B4=EB=B3=84=20?= =?UTF-8?q?=EB=8B=B9=EC=B2=A8=EC=9E=90=20=EC=B6=94=EC=B2=A8=20API(?= =?UTF-8?q?=EB=8C=93=EA=B8=80=20=EC=9D=B4=EB=B2=A4=ED=8A=B8)=20=EC=9A=94?= =?UTF-8?q?=EC=B2=AD=20=EB=B0=A9=EC=8B=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../event/crawl/controller/CommentApi.java | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/cmc/suppin/event/crawl/controller/CommentApi.java b/src/main/java/com/cmc/suppin/event/crawl/controller/CommentApi.java index a233fce..881fda9 100644 --- a/src/main/java/com/cmc/suppin/event/crawl/controller/CommentApi.java +++ b/src/main/java/com/cmc/suppin/event/crawl/controller/CommentApi.java @@ -1,5 +1,6 @@ package com.cmc.suppin.event.crawl.controller; +import com.cmc.suppin.event.crawl.controller.dto.CommentRequestDTO; import com.cmc.suppin.event.crawl.controller.dto.CommentResponseDTO; import com.cmc.suppin.event.crawl.service.CommentService; import com.cmc.suppin.global.response.ApiResponse; @@ -8,14 +9,12 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; @@ -44,16 +43,12 @@ public ResponseEntity> get return ResponseEntity.ok(ApiResponse.of(comments)); } - @GetMapping("/draft-winners") + @PostMapping("/draft-winners") @Operation(summary = "조건별 당첨자 추첨 API(댓글 이벤트)", description = "주어진 조건에 따라 이벤트의 당첨자를 추첨합니다.") public ResponseEntity> drawWinners( - @RequestParam Long eventId, - @RequestParam String startDate, - @RequestParam String endDate, - @RequestParam int winnerCount, - @RequestParam List keywords, + @RequestBody @Valid CommentRequestDTO.WinnerRequestDTO request, @CurrentAccount Account account) { - CommentResponseDTO.WinnerResponseDTO winners = commentService.drawWinners(eventId, startDate, endDate, winnerCount, keywords, account.userId()); + CommentResponseDTO.WinnerResponseDTO winners = commentService.drawWinners(request, account.userId()); return ResponseEntity.ok(ApiResponse.of(winners)); }