diff --git a/src/main/java/com/project/core/controller/CustomerController.java b/src/main/java/com/project/core/controller/CustomerController.java index 711d2a9..143b0d0 100644 --- a/src/main/java/com/project/core/controller/CustomerController.java +++ b/src/main/java/com/project/core/controller/CustomerController.java @@ -52,7 +52,6 @@ public ResponseEntity> getAllCustomers( public ResponseEntity searchByPhone( @RequestBody PhoneSearchRequest request) { Customer customer = customerService.loadByPhone(request.phoneRaw()); - Long customerId = customer.getCustomerId(); List subscriptions = diff --git a/src/main/java/com/project/core/infra/repository/plan/SubscriptionPlanRepository.java b/src/main/java/com/project/core/infra/repository/plan/SubscriptionPlanRepository.java index 14f8d72..1e54683 100644 --- a/src/main/java/com/project/core/infra/repository/plan/SubscriptionPlanRepository.java +++ b/src/main/java/com/project/core/infra/repository/plan/SubscriptionPlanRepository.java @@ -13,7 +13,7 @@ public interface SubscriptionPlanRepository extends JpaRepository CURRENT_TIMESTAMP") Optional findActivePlanBySubId(@Param("subId") Long subId); diff --git a/src/main/java/com/project/core/service/SubscriptionService.java b/src/main/java/com/project/core/service/SubscriptionService.java index 085cf63..52ce95c 100644 --- a/src/main/java/com/project/core/service/SubscriptionService.java +++ b/src/main/java/com/project/core/service/SubscriptionService.java @@ -67,7 +67,7 @@ public Slice getAllSubscriptions(Pageable pageable) { sub, totalUsedBytes, subPlan.getAllotmentAmount(), - subPlan.getPlanName(), + subPlan.getPlan().getPlanName(), decryptedEmail, decryptedPhone); }) @@ -115,7 +115,7 @@ public SubscriptionDetailResponse getSubscriptionDetailByPhone(String phoneRaw) sub, totalUsedBytes, subPlan.getAllotmentAmount(), - subPlan.getPlanName(), + subPlan.getPlan().getPlanName(), decryptedEmail, decryptedPhone); diff --git a/src/main/java/com/project/notification/infra/repository/TemplateGroupRepository.java b/src/main/java/com/project/notification/infra/repository/TemplateGroupRepository.java index e39b927..d245262 100644 --- a/src/main/java/com/project/notification/infra/repository/TemplateGroupRepository.java +++ b/src/main/java/com/project/notification/infra/repository/TemplateGroupRepository.java @@ -31,15 +31,4 @@ Page search( @Param("includeDeleted") boolean includeDeleted, @Param("keyword") String keyword, Pageable pageable); - - @Query( - """ - select g from TemplateGroup g - where (:includeDeleted = true or g.isDeleted = false) - and (:isActive is null or g.isActive = :isActive) - """) - Page searchWithoutKeyword( - @Param("isActive") Boolean isActive, - @Param("includeDeleted") boolean includeDeleted, - Pageable pageable); } diff --git a/src/main/java/com/project/notification/service/TemplateGroupService.java b/src/main/java/com/project/notification/service/TemplateGroupService.java index dd9be81..3c32a7d 100644 --- a/src/main/java/com/project/notification/service/TemplateGroupService.java +++ b/src/main/java/com/project/notification/service/TemplateGroupService.java @@ -56,13 +56,9 @@ public TemplateGroupResponse create(TemplateGroupCreateRequest request) { // 그룹 목록 조회 public Page getGroups( Boolean isActive, boolean includeDeleted, String keyword, Pageable pageable) { - if (keyword == null || keyword.isBlank()) { - return groupRepository - .searchWithoutKeyword(isActive, includeDeleted, pageable) - .map(TemplateGroupResponse::from); - } + String normalizedKeyword = (keyword == null || keyword.isBlank()) ? "" : keyword; return groupRepository - .search(isActive, includeDeleted, keyword, pageable) + .search(isActive, includeDeleted, normalizedKeyword, pageable) .map(TemplateGroupResponse::from); } diff --git a/src/main/resources/application-secret.yml b/src/main/resources/application-secret.yml index b567ae5..ac8c176 100644 --- a/src/main/resources/application-secret.yml +++ b/src/main/resources/application-secret.yml @@ -3,5 +3,5 @@ ureca: hash-key: ${URECA_HASH_KEY} billing: grafana: - iframe-url: http://34.22.76.102/d-solo/cfb0vm63z241sc/test?orgId=1&from=1769139882304&to=1769161482304&timezone=browser&panelId=1&__feature.dashboardSceneSolo + iframe-url: https://grafana.4e-um.cloud/public-dashboards/1656cac08ded4a22820d1ec97d3edad6?orgId=1 refresh-interval: 5s diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index d510c48..0fc80e3 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -43,4 +43,9 @@ + + + + + diff --git a/src/test/java/com/project/core/service/SubscriptionServiceTest.java b/src/test/java/com/project/core/service/SubscriptionServiceTest.java index a1dbf5b..50b0841 100644 --- a/src/test/java/com/project/core/service/SubscriptionServiceTest.java +++ b/src/test/java/com/project/core/service/SubscriptionServiceTest.java @@ -28,6 +28,7 @@ import com.project.core.controller.dto.response.SubscriptionResponse; import com.project.core.infra.entity.customer.Customer; import com.project.core.infra.entity.customer.enums.Grade; +import com.project.core.infra.entity.plan.Plan; import com.project.core.infra.entity.plan.SubscriptionPlan; import com.project.core.infra.entity.plan.enums.AllotmentPeriod; import com.project.core.infra.entity.subscription.Subscription; @@ -68,10 +69,7 @@ void getAllSubscriptionsSuccess() { Slice slice = new SliceImpl<>(List.of(sub)); // SubscriptionPlan Mock 설정 (Mockito mock 사용) - SubscriptionPlan subPlan = org.mockito.Mockito.mock(SubscriptionPlan.class); - given(subPlan.getSubscription()).willReturn(sub); - given(subPlan.getAllotmentPeriod()).willReturn(AllotmentPeriod.MONTH); - given(subPlan.getAllotmentAmount()).willReturn(10240L); + SubscriptionPlan subPlan = setupMockSubscriptionPlan(sub); given(subscriptionRepository.findAllSlice(pageable)).willReturn(slice); given(subscriptionPlanRepository.findActivePlanBySubId(1L)) @@ -110,10 +108,7 @@ void getSubscriptionDetailByPhoneSuccess() { Subscription sub = newInstanceSubscription(1L, customer); // SubscriptionPlan Mock 설정 (Mockito mock 사용) - SubscriptionPlan subPlan = org.mockito.Mockito.mock(SubscriptionPlan.class); - given(subPlan.getSubscription()).willReturn(sub); - given(subPlan.getAllotmentPeriod()).willReturn(AllotmentPeriod.MONTH); - given(subPlan.getAllotmentAmount()).willReturn(10240L); + SubscriptionPlan subPlan = setupMockSubscriptionPlan(sub); given(contactHashUtil.hmacSha256Base64(phoneRaw)).willReturn(hash); given(subscriptionRepository.findByPhoneHash(hash)).willReturn(Optional.of(sub)); @@ -154,6 +149,17 @@ private static Subscription newInstanceSubscription(Long subId, Customer custome return subscription; } + private static SubscriptionPlan setupMockSubscriptionPlan(Subscription sub) { + SubscriptionPlan subPlan = org.mockito.Mockito.mock(SubscriptionPlan.class); + Plan plan = org.mockito.Mockito.mock(Plan.class); + given(plan.getPlanName()).willReturn("BASIC"); + given(subPlan.getPlan()).willReturn(plan); + given(subPlan.getSubscription()).willReturn(sub); + given(subPlan.getAllotmentPeriod()).willReturn(AllotmentPeriod.MONTH); + given(subPlan.getAllotmentAmount()).willReturn(10240L); + return subPlan; + } + @Test @DisplayName("[조회] 성공 - 고객의 회선 목록 조회(응답 DTO 변환)") void findSubscriptionResponsesSuccess() {