Skip to content

Commit

Permalink
refactor: 인원 변동 요청 형태 변경 (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arachneee authored Jul 25, 2024
1 parent 97bd3e6 commit 3cb6872
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 20 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
package server.haengdong.presentation.request;

import jakarta.validation.constraints.NotBlank;
import java.util.List;
import server.haengdong.application.request.MemberActionSaveAppRequest;
import server.haengdong.application.request.MemberActionsSaveAppRequest;

public record MemberActionsSaveRequest(List<MemberActionSaveRequest> actions) {
public record MemberActionsSaveRequest(
List<String> members,

@NotBlank
String status
) {

public MemberActionsSaveAppRequest toAppRequest() {
List<MemberActionSaveAppRequest> appRequests = actions.stream()
.map(MemberActionSaveRequest::toAppRequest)
List<MemberActionSaveAppRequest> appRequests = members.stream()
.map(name -> new MemberActionSaveAppRequest(name, status))
.toList();

return new MemberActionsSaveAppRequest(appRequests);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import server.haengdong.application.MemberActionService;
import server.haengdong.application.response.CurrentMemberAppResponse;
import server.haengdong.presentation.request.MemberActionSaveRequest;
import server.haengdong.presentation.request.MemberActionsSaveRequest;

@WebMvcTest(MemberActionController.class)
Expand All @@ -38,11 +37,8 @@ class MemberActionControllerTest {
@DisplayName("참여자 행동을 추가한다.")
@Test
void saveMemberActionTest() throws Exception {
MemberActionsSaveRequest memberActionsSaveRequest = new MemberActionsSaveRequest(List.of(
new MemberActionSaveRequest("웨디", "IN"),
new MemberActionSaveRequest("소하", "IN"),
new MemberActionSaveRequest("토다리", "IN"),
new MemberActionSaveRequest("쿠키", "IN")));
MemberActionsSaveRequest memberActionsSaveRequest = new MemberActionsSaveRequest(
List.of("웨디", "소하", "토다리", "쿠키"), "IN");

String requestBody = objectMapper.writeValueAsString(memberActionsSaveRequest);

Expand All @@ -56,7 +52,8 @@ void saveMemberActionTest() throws Exception {
@DisplayName("현재 참여 인원을 조회합니다.")
@Test
void getCurrentMembers() throws Exception {
List<CurrentMemberAppResponse> currentMemberAppResponses = List.of(new CurrentMemberAppResponse("소하"), new CurrentMemberAppResponse("토다리"));
List<CurrentMemberAppResponse> currentMemberAppResponses = List.of(
new CurrentMemberAppResponse("소하"), new CurrentMemberAppResponse("토다리"));

given(memberActionService.getCurrentMembers(any())).willReturn(currentMemberAppResponses);

Expand Down

0 comments on commit 3cb6872

Please sign in to comment.