Skip to content

Commit

Permalink
merge: 행사 상세정보 조회 시 유무료 여부 반환
Browse files Browse the repository at this point in the history
feat: 행사 상세정보 조회 시 유무료 여부 반환
  • Loading branch information
hong-sile authored Sep 23, 2023
2 parents f49b8e5 + 51573e3 commit 45f1afe
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ class EventApiTest extends MockMvcTestHelper {
fieldWithPath("type").type(JsonFieldType.STRING)
.description("event의 타입"),
fieldWithPath("imageUrls[]").description("이미지 URL들").optional(),
fieldWithPath("organization").description("행사기관")
fieldWithPath("organization").description("행사기관"),
fieldWithPath("paymentType").description("유무료 여부(유료,무료,유무료)")
);

@Test
Expand All @@ -102,7 +103,7 @@ void findEvent() throws Exception {
"UPCOMING",
"ENDED", List.of("코틀린", "백엔드", "안드로이드"),
"https://www.image.com", 2, -12, EventType.COMPETITION.toString(),
List.of("imageUrl1", "imageUrl2"), "인프런");
List.of("imageUrl1", "imageUrl2"), "인프런", "유료");

Mockito.when(eventService.findEvent(ArgumentMatchers.anyLong(), any()))
.thenReturn(eventDetailResponse);
Expand Down Expand Up @@ -211,7 +212,7 @@ void updateEventTest() throws Exception {
request.getApplyStartDateTime(), request.getApplyEndDateTime(),
request.getLocation(), EventStatus.IN_PROGRESS.name(), EventStatus.ENDED.name(),
tags.stream().map(TagRequest::getName).collect(Collectors.toList()), request.getImageUrl(),
10, 10, request.getType().toString(), Collections.emptyList(), "행사기관");
10, 10, request.getType().toString(), Collections.emptyList(), "행사기관", "유료");

Mockito.when(eventService.updateEvent(any(), any(),
any())).thenReturn(response);
Expand Down Expand Up @@ -299,7 +300,7 @@ void addEventTest() throws Exception {
request.getLocation(), EventStatus.IN_PROGRESS.name(), EventStatus.ENDED.name(),
tags.stream().map(TagRequest::getName).collect(Collectors.toList()),
request.getImageUrl(), 10, 10, request.getType().toString(),
List.of("imageUrl1", "imageUrl2"), "행사기관");
List.of("imageUrl1", "imageUrl2"), "행사기관", "무료");

Mockito.when(eventService.addEvent(any(), any()))
.thenReturn(response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class EventDetailResponse {
private final String type;
private final List<String> imageUrls;
private final String organization;
private final String paymentType;

public static EventDetailResponse from(
final Event event,
Expand Down Expand Up @@ -67,7 +68,8 @@ public static EventDetailResponse from(
event.getEventPeriod().calculateApplyRemainingDays(today),
event.getType().toString(),
imageUrls,
event.getOrganization()
event.getOrganization(),
event.getPaymentType().getValue()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.emmsale.event.EventFixture;
import com.emmsale.event.domain.Event;
import com.emmsale.event.domain.EventStatus;
import com.emmsale.event.domain.PaymentType;
import java.time.LocalDate;
import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -37,7 +38,8 @@ void createEventDetailResponseTest() {
2, 2,
구름톤.getType().toString(),
imageUrls,
구름톤.getOrganization()
구름톤.getOrganization(),
PaymentType.FREE_PAID.getValue()
);

//when
Expand Down

0 comments on commit 45f1afe

Please sign in to comment.