Skip to content

Commit

Permalink
refactor: 현재 참여 인원 목록 조회 API 반환 형식 수정 (#361)
Browse files Browse the repository at this point in the history
  • Loading branch information
khabh authored Aug 16, 2024
1 parent b8fc84e commit 4695532
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 21 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import java.util.List;
import server.haengdong.application.response.CurrentMemberAppResponse;

public record CurrentMembersResponse(List<CurrentMemberResponse> members) {
public record CurrentMembersResponse(List<String> memberNames) {

public static CurrentMembersResponse of(List<CurrentMemberAppResponse> currentMembers) {
List<CurrentMemberResponse> responses = currentMembers.stream()
.map(CurrentMemberResponse::of)
List<String> responses = currentMembers.stream()
.map(CurrentMemberAppResponse::name)
.toList();

return new CurrentMembersResponse(responses);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ void getCurrentMembers() throws Exception {
.accept(MediaType.APPLICATION_JSON))
.andDo(print())
.andExpect(status().isOk())
.andExpect(jsonPath("$.members[0].name").value(equalTo("소하")))
.andExpect(jsonPath("$.members[1].name").value(equalTo("토다리")))
.andExpect(jsonPath("$.memberNames[0]").value(equalTo("소하")))
.andExpect(jsonPath("$.memberNames[1]").value(equalTo("토다리")))
.andDo(
document("getCurrentMembers",
preprocessRequest(prettyPrint()),
Expand All @@ -98,10 +98,8 @@ void getCurrentMembers() throws Exception {
parameterWithName("eventId").description("행사 ID")
),
responseFields(
fieldWithPath("members").type(JsonFieldType.ARRAY)
.description("액션 대상 참여자 목록"),
fieldWithPath("members[0].name").type(JsonFieldType.STRING)
.description("참여자 이름")
fieldWithPath("memberNames").type(JsonFieldType.ARRAY)
.description("현재 탈주 가능한 참여 인원 이름 목록")
)
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ void getCurrentMembers() throws Exception {
.accept(MediaType.APPLICATION_JSON))
.andDo(print())
.andExpect(status().isOk())
.andExpect(jsonPath("$.members[0].name").value(equalTo("소하")))
.andExpect(jsonPath("$.members[1].name").value(equalTo("토다리")));
.andExpect(jsonPath("$.memberNames[0]").value(equalTo("소하")))
.andExpect(jsonPath("$.memberNames[1]").value(equalTo("토다리")));
}

@DisplayName("이벤트에 속한 멤버 액션을 삭제하면 이후에 기록된 해당 참여자의 모든 멤버 액션을 삭제한다.")
Expand Down

0 comments on commit 4695532

Please sign in to comment.