diff options
| author | joonhoekim <26rote@gmail.com> | 2025-09-14 13:27:37 +0000 |
|---|---|---|
| committer | joonhoekim <26rote@gmail.com> | 2025-09-14 13:27:37 +0000 |
| commit | 3f293c90beb58ce206a66ff444d7acfc41b56429 (patch) | |
| tree | 7e0eb2f07b211b856d44c6bddad67d72759e1f47 /lib/vendors/service.ts | |
| parent | de81b281d9a3c2883a623c3f25e2889ec10a091b (diff) | |
(김준회) Vendor Pool 구현
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) + }; + } +} |
