From 34c4757d92bf0a8b999b03d2e45bae1451a05ff9 Mon Sep 17 00:00:00 2001 From: kseysh Date: Fri, 31 May 2024 22:18:08 +0900 Subject: [PATCH 1/2] =?UTF-8?q?refactor=20-=20#151=20=EC=82=AC=EC=9A=A9?= =?UTF-8?q?=EB=90=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20import=EB=AC=B8=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sopt/org/hmh/domain/point/controller/PointController.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/java/sopt/org/hmh/domain/point/controller/PointController.java b/src/main/java/sopt/org/hmh/domain/point/controller/PointController.java index e05e862a..0e2d3b93 100644 --- a/src/main/java/sopt/org/hmh/domain/point/controller/PointController.java +++ b/src/main/java/sopt/org/hmh/domain/point/controller/PointController.java @@ -1,8 +1,6 @@ package sopt.org.hmh.domain.point.controller; import java.time.LocalDate; -import java.util.List; - import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; @@ -10,7 +8,6 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import sopt.org.hmh.domain.challenge.domain.Challenge; import sopt.org.hmh.domain.point.dto.response.*; import sopt.org.hmh.domain.point.exception.PointSuccess; import sopt.org.hmh.domain.point.service.PointFacade; From d1fc1db016a94893e410b57b4401663ea995cbb8 Mon Sep 17 00:00:00 2001 From: kseysh Date: Fri, 31 May 2024 22:50:55 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix=20-=20#151=20LocalDate=EB=A5=BC=20DTO?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EB=B0=9B=EB=8F=84=EB=A1=9D=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sopt/org/hmh/domain/point/controller/PointApi.java | 9 +++------ .../hmh/domain/point/controller/PointController.java | 10 +++++----- .../domain/point/dto/request/ChallengeDateRequest.java | 8 ++++++++ 3 files changed, 16 insertions(+), 11 deletions(-) create mode 100644 src/main/java/sopt/org/hmh/domain/point/dto/request/ChallengeDateRequest.java diff --git a/src/main/java/sopt/org/hmh/domain/point/controller/PointApi.java b/src/main/java/sopt/org/hmh/domain/point/controller/PointApi.java index a06ed9af..527575ce 100644 --- a/src/main/java/sopt/org/hmh/domain/point/controller/PointApi.java +++ b/src/main/java/sopt/org/hmh/domain/point/controller/PointApi.java @@ -6,15 +6,12 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; -import java.time.LocalDate; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.PatchMapping; +import sopt.org.hmh.domain.point.dto.request.ChallengeDateRequest; import sopt.org.hmh.domain.point.dto.response.ChallengePointStatusListResponse; import sopt.org.hmh.domain.point.dto.response.EarnPointResponse; import sopt.org.hmh.domain.point.dto.response.UsagePointResponse; import sopt.org.hmh.domain.point.dto.response.UsePointResponse; -import sopt.org.hmh.domain.point.exception.PointSuccess; -import sopt.org.hmh.global.auth.UserId; import sopt.org.hmh.global.auth.jwt.JwtConstants; import sopt.org.hmh.global.common.response.BaseResponse; @@ -54,7 +51,7 @@ ResponseEntity> orderGetChallenge description = "서버 내부 오류입니다.", content = @Content)}) ResponseEntity> orderUsagePointAndChallengeFailed( - @Parameter(hidden = true) Long userId, LocalDate challengeDate); + @Parameter(hidden = true) Long userId, ChallengeDateRequest challengeDateRequest); @Operation( summary = "포인트 받기 API", @@ -71,7 +68,7 @@ ResponseEntity> orderUsagePointAndChallengeFailed description = "서버 내부 오류입니다.", content = @Content)}) ResponseEntity> orderEarnPointAndChallengeEarned( - @Parameter(hidden = true) Long userId, LocalDate challengeDate); + @Parameter(hidden = true) Long userId, ChallengeDateRequest challengeDateRequest); @Operation( summary = "사용할 포인트 받기 API", diff --git a/src/main/java/sopt/org/hmh/domain/point/controller/PointController.java b/src/main/java/sopt/org/hmh/domain/point/controller/PointController.java index 0e2d3b93..209b5f2c 100644 --- a/src/main/java/sopt/org/hmh/domain/point/controller/PointController.java +++ b/src/main/java/sopt/org/hmh/domain/point/controller/PointController.java @@ -1,6 +1,5 @@ package sopt.org.hmh.domain.point.controller; -import java.time.LocalDate; import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; @@ -8,6 +7,7 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import sopt.org.hmh.domain.point.dto.request.ChallengeDateRequest; import sopt.org.hmh.domain.point.dto.response.*; import sopt.org.hmh.domain.point.exception.PointSuccess; import sopt.org.hmh.domain.point.service.PointFacade; @@ -37,24 +37,24 @@ public ResponseEntity> orderGetCh @PatchMapping("/use") public ResponseEntity> orderUsagePointAndChallengeFailed( @UserId final Long userId, - @RequestBody final LocalDate challengeDate + @RequestBody final ChallengeDateRequest challengeDateRequest ) { return ResponseEntity .status(PointSuccess.POINT_USAGE_SUCCESS.getHttpStatus()) .body(BaseResponse.success(PointSuccess.POINT_USAGE_SUCCESS, - pointFacade.usePointAndChallengeFailed(userId, challengeDate))); + pointFacade.usePointAndChallengeFailed(userId, challengeDateRequest.challengeDate()))); } @Override @PatchMapping("/earn") public ResponseEntity> orderEarnPointAndChallengeEarned( @UserId final Long userId, - @RequestBody final LocalDate challengeDate + @RequestBody final ChallengeDateRequest challengeDateRequest ) { return ResponseEntity .status(PointSuccess.POINT_EARN_SUCCESS.getHttpStatus()) .body(BaseResponse.success(PointSuccess.POINT_EARN_SUCCESS, - pointFacade.earnPointAndChallengeEarned(userId, challengeDate))); + pointFacade.earnPointAndChallengeEarned(userId, challengeDateRequest.challengeDate()))); } @Override diff --git a/src/main/java/sopt/org/hmh/domain/point/dto/request/ChallengeDateRequest.java b/src/main/java/sopt/org/hmh/domain/point/dto/request/ChallengeDateRequest.java new file mode 100644 index 00000000..931db058 --- /dev/null +++ b/src/main/java/sopt/org/hmh/domain/point/dto/request/ChallengeDateRequest.java @@ -0,0 +1,8 @@ +package sopt.org.hmh.domain.point.dto.request; + +import java.time.LocalDate; + +public record ChallengeDateRequest( + LocalDate challengeDate +) { +} \ No newline at end of file