Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public ResponseEntity<Page<CustomerListResponse>> getAllCustomers(
public ResponseEntity<CustomerSearchResponse> searchByPhone(
@RequestBody PhoneSearchRequest request) {
Customer customer = customerService.loadByPhone(request.phoneRaw());

Long customerId = customer.getCustomerId();

List<SubscriptionResponse> subscriptions =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public interface SubscriptionPlanRepository extends JpaRepository<SubscriptionPl

// 해당 회선이 현재 사용 중인 요금제 조회 (leftDate가 현재보다 미래인 것)
@Query(
"SELECT sp from SubscriptionPlan sp "
"SELECT sp from SubscriptionPlan sp JOIN FETCH sp.plan "
+ "WHERE sp.subscription.subId = :subId AND sp.leftDate > CURRENT_TIMESTAMP")
Comment thread
arlen02-01 marked this conversation as resolved.
Optional<SubscriptionPlan> findActivePlanBySubId(@Param("subId") Long subId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public Slice<SubscriptionListResponse> getAllSubscriptions(Pageable pageable) {
sub,
totalUsedBytes,
subPlan.getAllotmentAmount(),
subPlan.getPlanName(),
subPlan.getPlan().getPlanName(),
decryptedEmail,
decryptedPhone);
})
Expand Down Expand Up @@ -115,7 +115,7 @@ public SubscriptionDetailResponse getSubscriptionDetailByPhone(String phoneRaw)
sub,
totalUsedBytes,
subPlan.getAllotmentAmount(),
subPlan.getPlanName(),
subPlan.getPlan().getPlanName(),
decryptedEmail,
decryptedPhone);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,4 @@ Page<TemplateGroup> 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<TemplateGroup> searchWithoutKeyword(
@Param("isActive") Boolean isActive,
@Param("includeDeleted") boolean includeDeleted,
Pageable pageable);
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,9 @@ public TemplateGroupResponse create(TemplateGroupCreateRequest request) {
// 그룹 목록 조회
public Page<TemplateGroupResponse> 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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application-secret.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 5 additions & 0 deletions src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,9 @@
<appender-ref ref="ASYNC_OTEL"/>
</root>
</springProfile>

<!-- fallback: always on -->
<root level="INFO">
<appender-ref ref="CONSOLE"/>
</root>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -68,10 +69,7 @@ void getAllSubscriptionsSuccess() {
Slice<Subscription> 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))
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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() {
Expand Down