diff options
Diffstat (limited to 'lib/vendor-document-list/enhanced-document-service.ts')
| -rw-r--r-- | lib/vendor-document-list/enhanced-document-service.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/vendor-document-list/enhanced-document-service.ts b/lib/vendor-document-list/enhanced-document-service.ts index 9eaa2a40..28fad74b 100644 --- a/lib/vendor-document-list/enhanced-document-service.ts +++ b/lib/vendor-document-list/enhanced-document-service.ts @@ -1027,11 +1027,11 @@ export async function getDocumentDetails(documentId: number) { // 2. 해당 벤더의 모든 계약 ID들 조회 const vendorContracts = await db - .select({ id: contracts.id }) + .select({ projectId: contracts.projectId }) .from(contracts) .where(eq(contracts.vendorId, companyId)) - const contractIds = vendorContracts.map(c => c.id) + const contractIds = vendorContracts.map(c => c.projectId) if (contractIds.length === 0) { return { data: [], pageCount: 0, total: 0, drawingKind: null, vendorInfo: null } @@ -1057,7 +1057,7 @@ export async function getDocumentDetails(documentId: number) { // 5. 최종 WHERE 조건 (계약 ID들로 필터링) const finalWhere = and( - inArray(simplifiedDocumentsView.contractId, contractIds), + inArray(simplifiedDocumentsView.projectId, contractIds), advancedWhere, globalWhere, ) @@ -1101,7 +1101,7 @@ export async function getDocumentDetails(documentId: number) { }) .from(contracts) .leftJoin(vendors, eq(contracts.vendorId, vendors.id)) - .where(eq(contracts.id, contractIds[0])) + .where(eq(contracts.projectId, contractIds[0])) .limit(1) return { data, total, drawingKind, vendorInfo } |
