fix: 공지사항 사용여부·상단고정·앱푸쉬가 저장되지 않던 문제
두 가지가 겹쳐 세 토글이 모두 먹히지 않았다.
1. 폼과 Server Action의 값 규약이 어긋났다. 팝업을 @fox로 옮기며 토글을 value="true"로 두었는데
게시판 액션의 readBoolean은 'Y'만 참으로 본다 — 켜도 항상 false가 되어 'N'으로 저장됐다.
꾸미기 아이템 쪽 규약을 그대로 가져온 것이 원인이라 게시판 규약('Y')에 맞췄다.
2. 수정 PUT을 쿼리스트링으로 보내고 있었다. 백엔드 update는 @RequestBody(JSON)라 본문이 비어
바인딩이 되지 않고, 통과하더라도 전 필드가 null이라 UPDATE의 가드가
모두 건너뛴다 — 수정으로는 어떤 값도 바뀌지 않았다. 1:1문의 답변 저장도 같은 경로였다.
등록 POST는 컨트롤러가 form 바인딩이라 그대로 둔다.
검증 — 팝업 FormData 실측: 기본 상태 isVisible='Y'(켜짐)·isPinned/isPushEnabled 없음(꺼짐),
두 토글을 켜면 셋 다 'Y'로 실린다(액션의 'Y' 규약과 일치).
TODO(백엔드): 앱푸쉬는 이 수정으로도 저장되지 않는다 — PUSH_YN이 MngrBbsMapper.xml의
INSERT·UPDATE·SELECT 어디에도 없다.
Co-Authored-By: Claude Opus 5
@0822da2d51ea083be9c46dcb2ce31e84dd98a2f2
--- app/(protected)/(basic)/boards/_components/board-post-form-modal.tsx
+++ app/(protected)/(basic)/boards/_components/board-post-form-modal.tsx
... | ... | @@ -193,7 +193,7 @@ |
| 193 | 193 |
<FoxToggleSwitch |
| 194 | 194 |
size="md" |
| 195 | 195 |
name="isPinned" |
| 196 |
- value="true" |
|
| 196 |
+ value="Y" |
|
| 197 | 197 |
label={isPinned ? '고정' : '미고정'}
|
| 198 | 198 |
checked={isPinned}
|
| 199 | 199 |
onChange={setIsPinned}
|
... | ... | @@ -237,7 +237,7 @@ |
| 237 | 237 |
<FoxToggleSwitch |
| 238 | 238 |
size="md" |
| 239 | 239 |
name="isVisible" |
| 240 |
- value="true" |
|
| 240 |
+ value="Y" |
|
| 241 | 241 |
label={isVisible ? '노출' : '미노출'}
|
| 242 | 242 |
checked={isVisible}
|
| 243 | 243 |
onChange={setIsVisible}
|
... | ... | @@ -250,7 +250,7 @@ |
| 250 | 250 |
<FoxToggleSwitch |
| 251 | 251 |
size="md" |
| 252 | 252 |
name="isPushEnabled" |
| 253 |
- value="true" |
|
| 253 |
+ value="Y" |
|
| 254 | 254 |
label={isPushEnabled ? '발송' : '미발송'}
|
| 255 | 255 |
checked={isPushEnabled}
|
| 256 | 256 |
onChange={setIsPushEnabled}
|
--- lib/data/repositories/board-post-repository.ts
+++ lib/data/repositories/board-post-repository.ts
... | ... | @@ -311,8 +311,7 @@ |
| 311 | 311 |
|
| 312 | 312 |
const result = await backendFetch<null>(`${BOARD_BASE_PATH}/${bbsId}`, {
|
| 313 | 313 |
method: 'PUT', |
| 314 |
- // 수정은 컨트롤러가 `@ParameterObject`라 쿼리스트링으로 받는다(본문이 아니다). |
|
| 315 |
- query: buildWriteParams(boardType, input), |
|
| 314 |
+ body: buildWriteParams(boardType, input), |
|
| 316 | 315 |
accessToken: accessToken ?? undefined, |
| 317 | 316 |
cache: 'no-store', |
| 318 | 317 |
// 쓰기 API는 성공해도 `data: null`을 돌려준다(ApiResponseVO.success(null)). |
... | ... | @@ -342,16 +341,16 @@ |
| 342 | 341 |
): Promise<void> {
|
| 343 | 342 |
const accessToken = await getSessionAccessToken(); |
| 344 | 343 |
|
| 345 |
- const query: Record<string, string> = {
|
|
| 344 |
+ const payload: Record<string, string> = {
|
|
| 346 | 345 |
stngId: BOARD_SETTING_IDS.inquiry, |
| 347 | 346 |
ansSttsCd: input.answerStatusCode, |
| 348 | 347 |
}; |
| 349 |
- if (input.answerContent) query.ansCn = input.answerContent; |
|
| 350 |
- if (input.attachmentId) query.atchFileId = input.attachmentId; |
|
| 348 |
+ if (input.answerContent) payload.ansCn = input.answerContent; |
|
| 349 |
+ if (input.attachmentId) payload.atchFileId = input.attachmentId; |
|
| 351 | 350 |
|
| 352 | 351 |
const result = await backendFetch<null>(`${BOARD_BASE_PATH}/${bbsId}`, {
|
| 353 | 352 |
method: 'PUT', |
| 354 |
- query, |
|
| 353 |
+ body: payload, |
|
| 355 | 354 |
accessToken: accessToken ?? undefined, |
| 356 | 355 |
cache: 'no-store', |
| 357 | 356 |
// 쓰기 API는 성공해도 `data: null`을 돌려준다(ApiResponseVO.success(null)). |
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?