Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix - request의 LocalDate의 역직렬화 오류 해결 #152

Merged
merged 2 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
) {
}
Loading