Skip to content

Commit

Permalink
refactor: 참가신청 취소하는 API에서 memberId를 queryParam으로 받도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
hong-sile committed Aug 2, 2023
1 parent 1692fda commit 3d5bf7a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ public ResponseEntity<Void> participateEvent(
@DeleteMapping("/{eventId}/participants")
public ResponseEntity<String> cancelParticipateEvent(
@PathVariable final Long eventId,
@RequestBody final EventParticipateRequest request,
@RequestParam(name = "member-id") final Long memberId,
final Member member
) {
eventService.cancelParticipate(eventId, request.getMemberId(), member);
eventService.cancelParticipate(eventId, memberId, member);

return ResponseEntity.noContent().build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,17 +127,13 @@ void cancelParticipateEvent() throws Exception {
final EventParticipateRequest request = new EventParticipateRequest(memberId);
final String fakeAccessToken = "Bearer accessToken";

final RequestFieldsSnippet requestFields = requestFields(
fieldWithPath("memberId").type(JsonFieldType.NUMBER).description("멤버 식별자")
);

//when
mockMvc.perform(delete(format("/events/%s/participants", eventId))
mockMvc.perform(delete(format("/events/%s/participants?member-id=%s", eventId, memberId))
.header("Authorization", fakeAccessToken)
.contentType(MediaType.APPLICATION_JSON)
.content(objectMapper.writeValueAsString(request)))
.andExpect(status().isNoContent())
.andDo(document("participate-event-cancel", requestFields));
.andDo(document("participate-event-cancel"));
}

@Test
Expand Down

0 comments on commit 3d5bf7a

Please sign in to comment.