--- lib/data/repositories/content-repository.ts
+++ lib/data/repositories/content-repository.ts
... | ... | @@ -248,7 +248,7 @@ |
| 248 | 248 |
thumbAtchFileId: string; |
| 249 | 249 |
useYn: string; |
| 250 | 250 |
keywordList: Array<{ cntntsKeyword: string; cntntsExpln: string }>;
|
| 251 |
- schulGrdList: Array<{ schulCd: string; grdCd: string }>;
|
|
| 251 |
+ schulGrdList: Array<{ schulCd: string; grdCd: string | null }>;
|
|
| 252 | 252 |
}; |
| 253 | 253 |
|
| 254 | 254 |
function toKeywordPayload(keywords: readonly ContentKeyword[]) {
|
... | ... | @@ -264,7 +264,8 @@ |
| 264 | 264 |
return []; |
| 265 | 265 |
} |
| 266 | 266 |
if (grades.length === 0) {
|
| 267 |
- return [{ schulCd: schoolCode, grdCd: '' }];
|
|
| 267 |
+ // 학년 없는 학교(전체연령 등)는 학교만 남긴다 — 빈 문자열을 넣으면 GRD_CD에 ''가 박힌다. |
|
| 268 |
+ return [{ schulCd: schoolCode, grdCd: null }];
|
|
| 268 | 269 |
} |
| 269 | 270 |
return grades.map((grade) => ({ schulCd: schoolCode, grdCd: grade }));
|
| 270 | 271 |
} |
... | ... | @@ -318,7 +319,8 @@ |
| 318 | 319 |
}); |
| 319 | 320 |
payload.schulGrdList.forEach((item, index) => {
|
| 320 | 321 |
params[`schulGrdList[${index}].schulCd`] = item.schulCd;
|
| 321 |
- params[`schulGrdList[${index}].grdCd`] = item.grdCd;
|
|
| 322 |
+ // undefined면 파라미터 자체가 빠져 백엔드에서 null이 된다. |
|
| 323 |
+ params[`schulGrdList[${index}].grdCd`] = item.grdCd ?? undefined;
|
|
| 322 | 324 |
}); |
| 323 | 325 |
|
| 324 | 326 |
return params; |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?