Skip to content

Commit

Permalink
merge: 참가신청 취소 API 에서 memberId를 queryParam으로 받도록 수정
Browse files Browse the repository at this point in the history
참가신청 취소하는 API에서 memberId를 queryParam으로 받도록 수정
  • Loading branch information
hong-sile authored Aug 2, 2023
2 parents 5db9a0e + 2344917 commit df5cc60
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
3 changes: 3 additions & 0 deletions backend/emm-sale/src/docs/asciidoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ include::{snippets}/participate-event/http-response.adoc[]
.HTTP request
include::{snippets}/participate-event-cancel/http-request.adoc[]

.HTTP request 설명
include::{snippets}/participate-event-cancel/request-parameters.adoc[]

.HTTP response
include::{snippets}/participate-event-cancel/http-response.adoc[]

Expand Down
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
6 changes: 1 addition & 5 deletions backend/emm-sale/src/main/resources/http/event.http
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,10 @@ Authorization: bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIiwiaWF0IjoxNjkwMTk2OTY5L
}

### Event 참여자 목록에서 멤버 삭제
DELETE http://localhost:8080/events/1/participants
DELETE http://localhost:8080/events/1/participants?member-id=1
Content-Type: application/json
Authorization: bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIiwiaWF0IjoxNjkwMTk2OTY5LCJleHAiOjE2OTM3OTY5Njl9.yahaEBvKBA7xelNuykx8TROhemnzJAsu1Sv5rrSfCM0

{
"memberId": 1
}

### 행사 참여자 목록 조회
GET http://localhost:8080/events/1/participants

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,17 +127,17 @@ 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("멤버 식별자")
final RequestParametersSnippet requestParameters = requestParameters(
parameterWithName("member-id").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", requestParameters));
}

@Test
Expand Down Expand Up @@ -463,6 +463,7 @@ void isAlreadyParticipate() throws Exception {
get("/events/{eventId}/participants/already-participate?member-id={memberId}"
, eventId, memberId)
)
.andExpect(status().isOk())
.andDo(document("check-already-participate"));
}
}

0 comments on commit df5cc60

Please sign in to comment.