From e73b0169e9ceabc855212c60831d643632ab47ee Mon Sep 17 00:00:00 2001 From: born-A <93516595+born-A@users.noreply.github.com> Date: Tue, 21 Nov 2023 17:39:09 +0900 Subject: [PATCH] NABI-NO-JIRA : suggestion update request param -> body --- .../domain/suggestion/api/SuggestionController.java | 12 ++++++------ .../dto/request/SuggestionUpdateRequestDTO.java | 8 ++++++++ 2 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 src/main/java/org/prgrms/nabimarketbe/domain/suggestion/dto/request/SuggestionUpdateRequestDTO.java diff --git a/src/main/java/org/prgrms/nabimarketbe/domain/suggestion/api/SuggestionController.java b/src/main/java/org/prgrms/nabimarketbe/domain/suggestion/api/SuggestionController.java index d74ed056..18826e0f 100644 --- a/src/main/java/org/prgrms/nabimarketbe/domain/suggestion/api/SuggestionController.java +++ b/src/main/java/org/prgrms/nabimarketbe/domain/suggestion/api/SuggestionController.java @@ -3,6 +3,7 @@ import lombok.RequiredArgsConstructor; import org.prgrms.nabimarketbe.domain.suggestion.dto.request.SuggestionRequestDTO; +import org.prgrms.nabimarketbe.domain.suggestion.dto.request.SuggestionUpdateRequestDTO; import org.prgrms.nabimarketbe.domain.suggestion.dto.response.projection.SuggestionListReadPagingResponseDTO; import org.prgrms.nabimarketbe.domain.suggestion.dto.response.SuggestionResponseDTO; import org.prgrms.nabimarketbe.domain.suggestion.entity.DirectionType; @@ -59,15 +60,14 @@ public ResponseEntity> getSugg @PutMapping("/decision") public ResponseEntity> updateSugggestionStatus( @RequestHeader(name = "Authorization") String token, - @RequestParam Long fromCardId, - @RequestParam Long toCardId, - @RequestParam Boolean isAccepted + @RequestBody SuggestionUpdateRequestDTO suggestionUpdateDTO + ) { SuggestionResponseDTO suggestionResponseDTO = suggestionService.updateSuggestionStatus( token, - fromCardId, - toCardId, - isAccepted + suggestionUpdateDTO.fromCardId(), + suggestionUpdateDTO.toCardId(), + suggestionUpdateDTO.isAccepted() ); return ResponseEntity.ok(ResponseFactory.getSingleResult(suggestionResponseDTO)); diff --git a/src/main/java/org/prgrms/nabimarketbe/domain/suggestion/dto/request/SuggestionUpdateRequestDTO.java b/src/main/java/org/prgrms/nabimarketbe/domain/suggestion/dto/request/SuggestionUpdateRequestDTO.java new file mode 100644 index 00000000..ee27e8ba --- /dev/null +++ b/src/main/java/org/prgrms/nabimarketbe/domain/suggestion/dto/request/SuggestionUpdateRequestDTO.java @@ -0,0 +1,8 @@ +package org.prgrms.nabimarketbe.domain.suggestion.dto.request; + +public record SuggestionUpdateRequestDTO( + Long fromCardId, + Long toCardId, + Boolean isAccepted +) { +}