summaryrefslogtreecommitdiff
path: root/lib/vendor-document-list/service.ts
diff options
context:
space:
mode:
authordujinkim <dujin.kim@dtsolution.co.kr>2025-08-04 09:36:14 +0000
committerdujinkim <dujin.kim@dtsolution.co.kr>2025-08-04 09:36:14 +0000
commit92eda21e45d902663052575aaa4c4f80bfa2faea (patch)
tree8483702edf82932d4359a597a854fa8e1b48e94b /lib/vendor-document-list/service.ts
parentf0213de0d2fb5fcb931b3ddaddcbb6581cab5d28 (diff)
(대표님) 벤더 문서 변경사항, data-table 변경, sync 변경
Diffstat (limited to 'lib/vendor-document-list/service.ts')
-rw-r--r--lib/vendor-document-list/service.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/vendor-document-list/service.ts b/lib/vendor-document-list/service.ts
index de6f0488..76bdac49 100644
--- a/lib/vendor-document-list/service.ts
+++ b/lib/vendor-document-list/service.ts
@@ -308,4 +308,19 @@ export async function getContractIdsByVendor(vendorId: number): Promise<number[]
console.error('Error fetching contract IDs by vendor:', error)
return []
}
+}
+
+export async function getProjectIdsByVendor(vendorId: number): Promise<number[]> {
+ try {
+ const contractsData = await db
+ .selectDistinct({ projectId: contracts.projectId })
+ .from(contracts)
+ .where(eq(contracts.vendorId, vendorId))
+ .orderBy(contracts.projectId) // projectId로 정렬하는 것이 더 의미있을 수 있음
+
+ return contractsData.map(contract => contract.projectId)
+ } catch (error) {
+ console.error('Error fetching contract IDs by vendor:', error)
+ return []
+ }
} \ No newline at end of file