diff options
Diffstat (limited to 'lib/vendor-document-list/service.ts')
| -rw-r--r-- | lib/vendor-document-list/service.ts | 15 |
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 |
