diff --git a/src/main/java/com/dreamypatisiel/devdevdev/web/dto/response/subscription/SubscriableCompanyResponse.java b/src/main/java/com/dreamypatisiel/devdevdev/web/dto/response/subscription/SubscriableCompanyResponse.java index 868bf188..47b33071 100644 --- a/src/main/java/com/dreamypatisiel/devdevdev/web/dto/response/subscription/SubscriableCompanyResponse.java +++ b/src/main/java/com/dreamypatisiel/devdevdev/web/dto/response/subscription/SubscriableCompanyResponse.java @@ -7,12 +7,14 @@ @Data public class SubscriableCompanyResponse { private final Long companyId; + private final String companyName; private final String companyImageUrl; private final Boolean isSubscribed; @Builder - public SubscriableCompanyResponse(Long companyId, String companyImageUrl, Boolean isSubscribed) { + public SubscriableCompanyResponse(Long companyId, String companyName, String companyImageUrl, Boolean isSubscribed) { this.companyId = companyId; + this.companyName = companyName; this.companyImageUrl = companyImageUrl; this.isSubscribed = isSubscribed; } @@ -20,6 +22,7 @@ public SubscriableCompanyResponse(Long companyId, String companyImageUrl, Boolea public static SubscriableCompanyResponse create(Company company) { return SubscriableCompanyResponse.builder() .companyId(company.getId()) + .companyName(company.getName().getCompanyName()) .companyImageUrl(company.getOfficialImageUrl().getUrl()) .isSubscribed(false) .build(); @@ -28,6 +31,7 @@ public static SubscriableCompanyResponse create(Company company) { public static SubscriableCompanyResponse createWithIsSubscribed(Company company, Boolean isSubscribed) { return SubscriableCompanyResponse.builder() .companyId(company.getId()) + .companyName(company.getName().getCompanyName()) .companyImageUrl(company.getOfficialImageUrl().getUrl()) .isSubscribed(isSubscribed) .build(); diff --git a/src/test/java/com/dreamypatisiel/devdevdev/web/controller/subscription/SubscriptionControllerTest.java b/src/test/java/com/dreamypatisiel/devdevdev/web/controller/subscription/SubscriptionControllerTest.java index 88cf59f6..aa28a7a0 100644 --- a/src/test/java/com/dreamypatisiel/devdevdev/web/controller/subscription/SubscriptionControllerTest.java +++ b/src/test/java/com/dreamypatisiel/devdevdev/web/controller/subscription/SubscriptionControllerTest.java @@ -78,7 +78,7 @@ void unsubscribe() throws Exception { @DisplayName("구독 가능한 기업 목록을 조회한다.") void getSubscriptions() throws Exception { // given - SubscriableCompanyResponse response = new SubscriableCompanyResponse(1L, + SubscriableCompanyResponse response = new SubscriableCompanyResponse(1L, "트이다", "https://www.teuida.net/public/src/img/teuida_logo.png", true); given(memberSubscriptionService.getSubscribableCompany(any(), anyLong(), any())) .willReturn(new SliceImpl<>(List.of(response), PageRequest.of(0, 20), false)); @@ -95,6 +95,7 @@ void getSubscriptions() throws Exception { .andExpect(jsonPath("$.data").isNotEmpty()) .andExpect(jsonPath("$.data.content").isArray()) .andExpect(jsonPath("$.data.content.[0].companyId").isNumber()) + .andExpect(jsonPath("$.data.content.[0].companyName").isString()) .andExpect(jsonPath("$.data.content.[0].companyImageUrl").isString()) .andExpect(jsonPath("$.data.content.[0].isSubscribed").isBoolean()) .andExpect(jsonPath("$.data.pageable").isNotEmpty()) diff --git a/src/test/java/com/dreamypatisiel/devdevdev/web/docs/SubscriptionControllerDocsTest.java b/src/test/java/com/dreamypatisiel/devdevdev/web/docs/SubscriptionControllerDocsTest.java index 2e736a39..f452458a 100644 --- a/src/test/java/com/dreamypatisiel/devdevdev/web/docs/SubscriptionControllerDocsTest.java +++ b/src/test/java/com/dreamypatisiel/devdevdev/web/docs/SubscriptionControllerDocsTest.java @@ -214,7 +214,7 @@ void unsubscribeSubscriptionException() throws Exception { @DisplayName("구독 가능한 기업 목록을 조회한다.") void getSubscriptions() throws Exception { // given - SubscriableCompanyResponse response = new SubscriableCompanyResponse(1L, + SubscriableCompanyResponse response = new SubscriableCompanyResponse(1L, "트이다", "https://www.teuida.net/public/src/img/teuida_logo.png", true); given(memberSubscriptionService.getSubscribableCompany(any(), anyLong(), any())) .willReturn(new SliceImpl<>(List.of(response), PageRequest.of(0, 20), false)); @@ -247,6 +247,7 @@ void getSubscriptions() throws Exception { fieldWithPath("data.content").type(ARRAY).description("구독 가능한 기업 목록 메인 배열"), fieldWithPath("data.content[].companyId").type(NUMBER).description("기업 아이디"), + fieldWithPath("data.content[].companyName").type(STRING).description("기업명"), fieldWithPath("data.content[].companyImageUrl").type(STRING).description("기업 로고 이미지 url"), fieldWithPath("data.content[].isSubscribed").type(JsonFieldType.BOOLEAN) .description("회원의 구독 여부"),