diff options
Diffstat (limited to 'app/api/revisions/max-serial-no/route.ts')
| -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 조회 |
