Skip to content

Commit

Permalink
[feat] : 응답에 이벤트 ID 필드를 추가한다 (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
bbbang105 authored Jan 15, 2025
1 parent f15907f commit d88ba2d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
@JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class)
@JsonInclude(JsonInclude.Include.NON_NULL)
public record GetEventResponse(
String eventId,
String title,
String startTime,
String endTime,
Expand All @@ -21,6 +22,7 @@ public record GetEventResponse(
) {
public static GetEventResponse of(Event event, List<String> ranges, EventStatus eventStatus) {
return new GetEventResponse(
String.valueOf(event.getEventId()),
event.getTitle(),
event.getStartTime(),
event.getEndTime(),
Expand Down
3 changes: 3 additions & 0 deletions src/test/java/side/onetime/event/EventControllerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public void getEvent() throws Exception {
// given
UUID eventId = UUID.randomUUID();
GetEventResponse response = new GetEventResponse(
"1f4c4558-97f8-49c1-aec4-f681173534d0",
"Sample Event",
"10:00",
"12:00",
Expand All @@ -139,6 +140,7 @@ public void getEvent() throws Exception {
.andExpect(jsonPath("$.is_success").value(true))
.andExpect(jsonPath("$.code").value("200"))
.andExpect(jsonPath("$.message").value("이벤트 조회에 성공했습니다."))
.andExpect(jsonPath("$.payload.event_id").value("1f4c4558-97f8-49c1-aec4-f681173534d0"))
.andExpect(jsonPath("$.payload.title").value("Sample Event"))
.andExpect(jsonPath("$.payload.start_time").value("10:00"))
.andExpect(jsonPath("$.payload.end_time").value("12:00"))
Expand All @@ -162,6 +164,7 @@ public void getEvent() throws Exception {
fieldWithPath("code").type(JsonFieldType.STRING).description("응답 코드"),
fieldWithPath("message").type(JsonFieldType.STRING).description("응답 메시지"),
fieldWithPath("payload").type(JsonFieldType.OBJECT).description("응답 데이터"),
fieldWithPath("payload.event_id").type(JsonFieldType.STRING).description("이벤트 ID"),
fieldWithPath("payload.title").type(JsonFieldType.STRING).description("이벤트 제목"),
fieldWithPath("payload.start_time").type(JsonFieldType.STRING).description("이벤트 시작 시간"),
fieldWithPath("payload.end_time").type(JsonFieldType.STRING).description("이벤트 종료 시간"),
Expand Down

0 comments on commit d88ba2d

Please sign in to comment.