Skip to content

Commit

Permalink
Merge pull request #152 from Team-HMH/fix/#151-localdate-deserialize-…
Browse files Browse the repository at this point in the history
…error

fix - request의 LocalDate의 역직렬화 오류 해결
  • Loading branch information
kseysh authored May 31, 2024
2 parents 466674c + d1fc1db commit ccc6916
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -54,7 +51,7 @@ ResponseEntity<BaseResponse<ChallengePointStatusListResponse>> orderGetChallenge
description = "서버 내부 오류입니다.",
content = @Content)})
ResponseEntity<BaseResponse<UsePointResponse>> orderUsagePointAndChallengeFailed(
@Parameter(hidden = true) Long userId, LocalDate challengeDate);
@Parameter(hidden = true) Long userId, ChallengeDateRequest challengeDateRequest);

@Operation(
summary = "포인트 받기 API",
Expand All @@ -71,7 +68,7 @@ ResponseEntity<BaseResponse<UsePointResponse>> orderUsagePointAndChallengeFailed
description = "서버 내부 오류입니다.",
content = @Content)})
ResponseEntity<BaseResponse<EarnPointResponse>> orderEarnPointAndChallengeEarned(
@Parameter(hidden = true) Long userId, LocalDate challengeDate);
@Parameter(hidden = true) Long userId, ChallengeDateRequest challengeDateRequest);

@Operation(
summary = "사용할 포인트 받기 API",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
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;
import org.springframework.web.bind.annotation.PatchMapping;
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;
Expand Down Expand Up @@ -40,24 +37,24 @@ public ResponseEntity<BaseResponse<ChallengePointStatusListResponse>> orderGetCh
@PatchMapping("/use")
public ResponseEntity<BaseResponse<UsePointResponse>> 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<BaseResponse<EarnPointResponse>> 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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package sopt.org.hmh.domain.point.dto.request;

import java.time.LocalDate;

public record ChallengeDateRequest(
LocalDate challengeDate
) {
}

0 comments on commit ccc6916

Please sign in to comment.