diff options
| author | joonhoekim <26rote@gmail.com> | 2025-11-24 18:37:09 +0900 |
|---|---|---|
| committer | joonhoekim <26rote@gmail.com> | 2025-11-24 18:37:09 +0900 |
| commit | e6c637e16550437ac0ecd58c79ce62a4fe397fb7 (patch) | |
| tree | 8462a00a9328676db0618b4cac8361c20f5272bb /app | |
| parent | af813883db9bae24755e05205647954fd0ab1270 (diff) | |
(김준회) dolce: maxSerialNo 못 받는 경우 폴백(1) 추가
Diffstat (limited to 'app')
| -rw-r--r-- | app/api/revisions/max-serial-no/route.ts | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/app/api/revisions/max-serial-no/route.ts b/app/api/revisions/max-serial-no/route.ts index 0681b66d..6cdf18b6 100644 --- a/app/api/revisions/max-serial-no/route.ts +++ b/app/api/revisions/max-serial-no/route.ts @@ -18,8 +18,8 @@ export async function GET(request: NextRequest) { debugLog('1. Input documentId:', documentId) - if (!documentId) { - debugLog('2. documentId is missing, returning 400') + if (!documentId || documentId === 'undefined' || documentId === 'null') { + debugLog('2. documentId is missing or invalid, returning 400') return NextResponse.json( { error: 'documentId is required' }, { status: 400 } @@ -27,6 +27,15 @@ export async function GET(request: NextRequest) { } const parsedDocumentId = parseInt(documentId) + + if (isNaN(parsedDocumentId)) { + debugError('3. Invalid documentId - cannot parse to integer:', documentId) + return NextResponse.json( + { error: 'Invalid documentId format' }, + { status: 400 } + ) + } + debugLog('3. Parsed documentId:', parsedDocumentId) // 1. 내부 DB에서 최대 serialNo 조회 |
