From 64b16282fea10ed94dc1c4f1b81703c4875d9f7e Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Mon, 10 Nov 2025 17:57:27 +0900 Subject: (김준회) taxId 필수값에서 제거 (MDG에서 사업자번호(세금번호) 없는 벤더가 들어오기 때문) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/auth/signup-with-vendor/route.ts | 25 ++++++++++++++----------- app/api/vendors/route.ts | 30 ++++++++++++++++-------------- 2 files changed, 30 insertions(+), 25 deletions(-) (limited to 'app/api') diff --git a/app/api/auth/signup-with-vendor/route.ts b/app/api/auth/signup-with-vendor/route.ts index 4585778c..f8c2c6ee 100644 --- a/app/api/auth/signup-with-vendor/route.ts +++ b/app/api/auth/signup-with-vendor/route.ts @@ -408,17 +408,20 @@ export async function POST(request: NextRequest) { ) } - const existingVendor = await db - .select({ id: vendors.id }) - .from(vendors) - .where(eq(vendors.taxId, vendor.taxId)) - .limit(1) - - if (existingVendor.length > 0) { - return NextResponse.json( - { error: '이미 등록된 사업자등록번호입니다.' }, - { status: 400 } - ) + // Check for existing taxId (only if taxId is provided) + if (vendor.taxId && vendor.taxId.trim()) { + const existingVendor = await db + .select({ id: vendors.id }) + .from(vendors) + .where(eq(vendors.taxId, vendor.taxId)) + .limit(1) + + if (existingVendor.length > 0) { + return NextResponse.json( + { error: '이미 등록된 사업자등록번호입니다.' }, + { status: 400 } + ) + } } // 클라이언트 정보 추출 diff --git a/app/api/vendors/route.ts b/app/api/vendors/route.ts index 760f183e..27b79385 100644 --- a/app/api/vendors/route.ts +++ b/app/api/vendors/route.ts @@ -162,20 +162,22 @@ export async function POST(request: NextRequest) { ) } - // Check for existing taxId - const existingVendor = await db - .select({ id: vendors.id }) - .from(vendors) - .where(eq(vendors.taxId, vendorData.taxId)) - .limit(1) - - if (existingVendor.length > 0) { - return NextResponse.json( - { - error: `이미 등록된 사업자등록번호입니다. (Tax ID ${vendorData.taxId} already exists in the system)` - }, - { status: 400 } - ) + // Check for existing taxId (only if taxId is provided) + if (vendorData.taxId && vendorData.taxId.trim()) { + const existingVendor = await db + .select({ id: vendors.id }) + .from(vendors) + .where(eq(vendors.taxId, vendorData.taxId)) + .limit(1) + + if (existingVendor.length > 0) { + return NextResponse.json( + { + error: `이미 등록된 사업자등록번호입니다. (Tax ID ${vendorData.taxId} already exists in the system)` + }, + { status: 400 } + ) + } } // Create vendor and handle files in transaction -- cgit v1.2.3