diff --git a/server/src/main/java/server/haengdong/application/request/MemberActionSaveListAppRequest.java b/server/src/main/java/server/haengdong/application/request/MemberActionSaveListAppRequest.java deleted file mode 100644 index f4cc8d44a..000000000 --- a/server/src/main/java/server/haengdong/application/request/MemberActionSaveListAppRequest.java +++ /dev/null @@ -1,6 +0,0 @@ -package server.haengdong.application.request; - -import java.util.List; - -public record MemberActionSaveListAppRequest(List actions) { -} diff --git a/server/src/main/java/server/haengdong/application/request/MemberActionsSaveAppRequest.java b/server/src/main/java/server/haengdong/application/request/MemberActionsSaveAppRequest.java new file mode 100644 index 000000000..650b908df --- /dev/null +++ b/server/src/main/java/server/haengdong/application/request/MemberActionsSaveAppRequest.java @@ -0,0 +1,6 @@ +package server.haengdong.application.request; + +import java.util.List; + +public record MemberActionsSaveAppRequest(List actions) { +} diff --git a/server/src/main/java/server/haengdong/presentation/MemberActionController.java b/server/src/main/java/server/haengdong/presentation/MemberActionController.java index ce0801a9b..e35bcfd7b 100644 --- a/server/src/main/java/server/haengdong/presentation/MemberActionController.java +++ b/server/src/main/java/server/haengdong/presentation/MemberActionController.java @@ -7,7 +7,7 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import server.haengdong.application.MemberActionService; -import server.haengdong.presentation.request.MemberActionSaveListRequest; +import server.haengdong.presentation.request.MemberActionsSaveRequest; @RequiredArgsConstructor @RestController @@ -18,7 +18,7 @@ public class MemberActionController { @PostMapping("/api/events/{token}/actions/members") public ResponseEntity saveMemberAction( @PathVariable("token") String token, - @RequestBody MemberActionSaveListRequest request + @RequestBody MemberActionsSaveRequest request ) { memberActionService.saveMemberAction(token, request.toAppRequest()); diff --git a/server/src/main/java/server/haengdong/presentation/request/MemberActionSaveListRequest.java b/server/src/main/java/server/haengdong/presentation/request/MemberActionsSaveRequest.java similarity index 52% rename from server/src/main/java/server/haengdong/presentation/request/MemberActionSaveListRequest.java rename to server/src/main/java/server/haengdong/presentation/request/MemberActionsSaveRequest.java index 39a724771..bfe80f0ee 100644 --- a/server/src/main/java/server/haengdong/presentation/request/MemberActionSaveListRequest.java +++ b/server/src/main/java/server/haengdong/presentation/request/MemberActionsSaveRequest.java @@ -2,15 +2,15 @@ import java.util.List; import server.haengdong.application.request.MemberActionSaveAppRequest; -import server.haengdong.application.request.MemberActionSaveListAppRequest; +import server.haengdong.application.request.MemberActionsSaveAppRequest; -public record MemberActionSaveListRequest(List actions) { +public record MemberActionsSaveRequest(List actions) { - public MemberActionSaveListAppRequest toAppRequest() { + public MemberActionsSaveAppRequest toAppRequest() { List appRequests = actions.stream() .map(MemberActionSaveRequest::toAppRequest) .toList(); - return new MemberActionSaveListAppRequest(appRequests); + return new MemberActionsSaveAppRequest(appRequests); } } diff --git a/server/src/test/java/server/haengdong/presentation/EventControllerTest.java b/server/src/test/java/server/haengdong/presentation/EventControllerTest.java index b60fb6525..a1d67f0a1 100644 --- a/server/src/test/java/server/haengdong/presentation/EventControllerTest.java +++ b/server/src/test/java/server/haengdong/presentation/EventControllerTest.java @@ -32,18 +32,18 @@ class EventControllerTest { @MockBean private EventService eventService; - @DisplayName("이벤트를 생성한다") + @DisplayName("이벤트를 생성한다.") @Test void saveEvent() throws Exception { - EventSaveRequest eventSaveRequest = new EventSaveRequest("test"); + EventSaveRequest eventSaveRequest = new EventSaveRequest("토다리"); String requestBody = objectMapper.writeValueAsString(eventSaveRequest); String token = "TOKEN"; EventAppResponse eventAppResponse = new EventAppResponse(token); given(eventService.saveEvent(any(EventAppRequest.class))).willReturn(eventAppResponse); mockMvc.perform(post("/api/events") - .contentType(MediaType.APPLICATION_JSON) - .content(requestBody)) + .contentType(MediaType.APPLICATION_JSON) + .content(requestBody)) .andDo(print()) .andExpect(status().isOk()) .andExpect(MockMvcResultMatchers.redirectedUrl("events/" + token)); diff --git a/server/src/test/java/server/haengdong/presentation/MemberActionControllerTest.java b/server/src/test/java/server/haengdong/presentation/MemberActionControllerTest.java index afdcbaec5..8f9e71182 100644 --- a/server/src/test/java/server/haengdong/presentation/MemberActionControllerTest.java +++ b/server/src/test/java/server/haengdong/presentation/MemberActionControllerTest.java @@ -14,9 +14,8 @@ import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MockMvc; import server.haengdong.application.MemberActionService; -import server.haengdong.presentation.request.MemberActionSaveListRequest; import server.haengdong.presentation.request.MemberActionSaveRequest; - +import server.haengdong.presentation.request.MemberActionsSaveRequest; @WebMvcTest(MemberActionController.class) class MemberActionControllerTest { @@ -30,20 +29,20 @@ class MemberActionControllerTest { @MockBean private MemberActionService memberActionService; - @DisplayName("참여자 행동을 추가한다") + @DisplayName("참여자 행동을 추가한다.") @Test void saveMemberActionTest() throws Exception { - MemberActionSaveListRequest memberActionSaveListRequest = new MemberActionSaveListRequest(List.of( - new MemberActionSaveRequest("망쵸", "IN"), - new MemberActionSaveRequest("이상", "IN"), - new MemberActionSaveRequest("백호", "IN"), - new MemberActionSaveRequest("감자", "IN"))); + MemberActionsSaveRequest memberActionsSaveRequest = new MemberActionsSaveRequest(List.of( + new MemberActionSaveRequest("웨디", "IN"), + new MemberActionSaveRequest("소하", "IN"), + new MemberActionSaveRequest("토다리", "IN"), + new MemberActionSaveRequest("쿠키", "IN"))); - String requestBody = objectMapper.writeValueAsString(memberActionSaveListRequest); + String requestBody = objectMapper.writeValueAsString(memberActionsSaveRequest); mockMvc.perform(post("/api/events/TOKEN/actions/members") - .contentType(MediaType.APPLICATION_JSON) - .content(requestBody)) + .contentType(MediaType.APPLICATION_JSON) + .content(requestBody)) .andDo(print()) .andExpect(status().isOk()); }