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 e05e862a..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,8 +1,5 @@ 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 +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.challenge.domain.Challenge; +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; @@ -40,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