임동욱 임동욱 08-20
fix: 학년 없는 학교의 grdCd를 빈 문자열 대신 null로
학년을 고르지 않으면 GRD_CD에 ''이 박히고 있었다. 구조는 그대로 두고 값만 비운다.

Co-Authored-By: Claude Opus 5 
@b22b2a373c5ae06eacff50f5642fe2b4db74c90e
lib/data/repositories/content-repository.ts
--- lib/data/repositories/content-repository.ts
+++ lib/data/repositories/content-repository.ts
@@ -248,7 +248,7 @@
   thumbAtchFileId: string;
   useYn: string;
   keywordList: Array<{ cntntsKeyword: string; cntntsExpln: string }>;
-  schulGrdList: Array<{ schulCd: string; grdCd: string }>;
+  schulGrdList: Array<{ schulCd: string; grdCd: string | null }>;
 };
 
 function toKeywordPayload(keywords: readonly ContentKeyword[]) {
@@ -264,7 +264,8 @@
     return [];
   }
   if (grades.length === 0) {
-    return [{ schulCd: schoolCode, grdCd: '' }];
+    // 학년 없는 학교(전체연령 등)는 학교만 남긴다 — 빈 문자열을 넣으면 GRD_CD에 ''가 박힌다.
+    return [{ schulCd: schoolCode, grdCd: null }];
   }
   return grades.map((grade) => ({ schulCd: schoolCode, grdCd: grade }));
 }
@@ -318,7 +319,8 @@
   });
   payload.schulGrdList.forEach((item, index) => {
     params[`schulGrdList[${index}].schulCd`] = item.schulCd;
-    params[`schulGrdList[${index}].grdCd`] = item.grdCd;
+    // undefined면 파라미터 자체가 빠져 백엔드에서 null이 된다.
+    params[`schulGrdList[${index}].grdCd`] = item.grdCd ?? undefined;
   });
 
   return params;
Add a comment
List