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

[BE] 인원 변동 요청 형태 변경 #117

Merged
merged 1 commit into from
Jul 25, 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

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
Loading