fix: 관리자 알림 이력·공개 카테고리의 null 필터 500 수정과 관리자 Query null 입력 게이트 - #484
Conversation
관리자 FE가 알림 이력 '전체' 필터를 type: null, targetKind: null로 보내면 service가 null을 그대로 repository로 넘겨 Prisma where에 type: null이 들어가 500(Argument `type` must not be null). 매장·상품·배너 isActive(#434)에 이은 두 번째 같은 유형이라, 이번에는 admin Query 전수를 SDL에서 읽어 실제 앱으로 보내는 게이트로 막는다. - adminNotificationBroadcasts: type·targetKind를 ?? undefined로 정규화, DTO를 | null로 선언해 다음 누락은 tsc가 잡게 함 - 전수 점검: input 객체를 받는 admin Query 17개, nullable 입력 필드 70자리 - 고침 2(알림 이력 type·targetKind) - 그대로 둠 68: 페이지 limit·cursor 27, keyword trim 7, ID parseOptionalId 13, 기본값 false 불리언 4, 날짜 toDate 5, repository가 truthy·일치 비교로 거르는 enum 8, 명시적 null = 전체인 신고 status 1, 이미 정규화된 isActive 3 - 게이트 src/test/admin-query-null-inputs.spec.ts - nullable 필드 전부 null, input 인자 자체 null 두 경우를 main.ts와 같은 파이프·필터·가드·실DB로 보내 5xx·INTERNAL_ERROR 없음, 리졸버까지 닿아 data가 옴을 단언(17 + 16건) - 대상 수 17 고정, 입력 오류는 VALIDATION_FAILED(400)로 나가는지 대조, 판정기·입력 생성기 반증 - 반증 실측: 알림 정규화를 되돌리면 adminNotificationBroadcasts 1건만 실패(운영과 같은 Prisma 오류), isActive 3자리를 되돌리면 adminStores·adminProducts·adminBanners 3건 실패 - createTestingModuleWithRealDb가 PrismaService를 override해 AppModule 트리도 실DB 테스트 클라이언트를 쓰게 함 - 회귀: 알림 service spec·DTO spec에 null 필터 케이스 추가
- 전수 점검 중 발견: categories(input: { type: null })이 category_type: null을 Prisma에 넘겨 500(홈 칩·카테고리 진입 화면이 쓰는 조회)
- service ?? undefined 정규화 + DTO | null
- 회귀: type null이면 전체(수정 전 'category_type must not be null'로 실패 확인)
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🩺 NestJS Doctor — 90/100 (Excellent)진단 470건 (error 12).
architecture / security 상위 항목
|
🧹 knip — dead-code 리포트전체 리포트
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Coverage report
Test suite run success3723 tests passing in 355 suites. Report generated by 🧪jest coverage report action from 62b8441 |
배경
adminNotificationBroadcasts(input: { type: null, targetKind: null })처럼 null로 보냅니다. service가 null을 그대로 넘겨 Prisma where에type: null이 들어갔고Argument \type` must not be null`로 500이 났습니다.변경
?? undefined로 정규화했습니다.AdminNotificationBroadcastListInput의 두 필드를| null로 선언(정규화가 빠지면 tsc가 막음)categories(input: { type: null })도 같은 이유로 500이라 함께 고쳤습니다(홈 칩·카테고리 진입 화면이 쓰는 조회).src/test/admin-query-null-inputs.spec.ts를 추가했습니다.admin접두 Query 중 input 객체 인자를 받는 필드 전부(현재 17개, 개수 고정)createTestingModuleWithRealDb에 PrismaService override를 추가했습니다(AppModule 트리도 테스트 클라이언트를 쓰게).테스트
adminNotificationBroadcasts1건만 INTERNAL_ERROR(500)로 실패하고 로그에 운영과 같은 Prisma 오류가 찍힘adminStores·adminProducts·adminBanners3건 실패category_type must not be null로 실패yarn validate:push가 통과했습니다(테스트 인프라 변경으로 full: 355 suites, 3722 tests).플랜 대조
| null