From e6c637e16550437ac0ecd58c79ce62a4fe397fb7 Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Mon, 24 Nov 2025 18:37:09 +0900 Subject: (김준회) dolce: maxSerialNo 못 받는 경우 폴백(1) 추가 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/revisions/max-serial-no/route.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'app/api/revisions') 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 조회 -- cgit v1.2.3