Skip to content

Commit 80cc3d5

Browse files
committed
refactor/367 관리자 대시보드 null처리 추가
1 parent 1f0dbc7 commit 80cc3d5

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/main/java/com/back/domain/dashboard/admin/service/AdminDashboardServiceImpl.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ public AdminOverviewResponse getOverview(AdminOverviewRequest request) {
121121
.getContent();
122122

123123
List<AdminOverviewResponse.ArtistApproval> artistApprovals = pendingApplications.stream()
124+
.filter(app -> app.getUser() != null) // User가 null인 경우 필터링
124125
.map(app -> new AdminOverviewResponse.ArtistApproval(
125126
app.getUser().getId(),
126127
app.getArtistName(),
@@ -137,6 +138,7 @@ public AdminOverviewResponse getOverview(AdminOverviewRequest request) {
137138
.getContent();
138139

139140
List<AdminOverviewResponse.FundingApproval> fundingApprovals = pendingFundings.stream()
141+
.filter(funding -> funding.getUser() != null) // User가 null인 경우 필터링
140142
.map(funding -> new AdminOverviewResponse.FundingApproval(
141143
funding.getId(),
142144
funding.getTitle(),
@@ -649,6 +651,13 @@ public AdminFundingResponse getFundings(AdminFundingSearchRequest request) {
649651
* Funding Entity → DTO 변환 (화면 표시 필드만, 평면 구조)
650652
*/
651653
private AdminFundingResponse.Funding convertToFundingDto(Funding funding) {
654+
// User null 체크 (FK 제약조건상 발생하면 안되지만 방어적 처리)
655+
if (funding.getUser() == null) {
656+
log.error("Funding의 User가 null입니다 - fundingId: {}", funding.getId());
657+
throw new ServiceException("DATA_INTEGRITY_ERROR",
658+
"펀딩 데이터 무결성 오류 - fundingId: " + funding.getId());
659+
}
660+
652661
// 달성률 계산
653662
int achievementRate = funding.getTargetAmount() > 0
654663
? (int) ((funding.getCollectedAmount() * 100) / funding.getTargetAmount())
@@ -791,6 +800,13 @@ public AdminArtistApplicationResponse getArtistApplications(AdminArtistApplicati
791800
* ArtistApplication Entity → DTO 변환
792801
*/
793802
private AdminArtistApplicationResponse.Application convertToApplicationDto(ArtistApplication application) {
803+
// User null 체크 (FK 제약조건상 발생하면 안되지만 방어적 처리)
804+
if (application.getUser() == null) {
805+
log.error("ArtistApplication의 User가 null입니다 - applicationId: {}", application.getId());
806+
throw new ServiceException("DATA_INTEGRITY_ERROR",
807+
"입점 신청 데이터 무결성 오류 - applicationId: " + application.getId());
808+
}
809+
794810
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
795811

796812
return new AdminArtistApplicationResponse.Application(

0 commit comments

Comments
 (0)