diff options
Diffstat (limited to 'lib/vendors/service.ts')
| -rw-r--r-- | lib/vendors/service.ts | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/lib/vendors/service.ts b/lib/vendors/service.ts index 22d58ae1..45a0e0b5 100644 --- a/lib/vendors/service.ts +++ b/lib/vendors/service.ts @@ -3101,9 +3101,38 @@ export async function saveNdaAttachments(input: { console.error("비밀유지 계약서 첨부파일 저장 중 오류 발생:", error); return { success: false, - error: error instanceof Error - ? error.message + error: error instanceof Error + ? error.message : "첨부파일 저장 처리 중 오류가 발생했습니다." }; } } + +// 사업자번호(taxId)로 벤더 정보 검색 +export async function getVendorByTaxId(taxId: string) { + unstable_noStore(); + + try { + const result = await db + .select({ + id: vendors.id, + vendorCode: vendors.vendorCode, + vendorName: vendors.vendorName, + taxId: vendors.taxId, + }) + .from(vendors) + .where(eq(vendors.taxId, taxId)) + .limit(1); + + return { + data: result[0] || null, + error: null + }; + } catch (err) { + console.error("Error getting vendor by taxId:", err); + return { + data: null, + error: getErrorMessage(err) + }; + } +} |
