summaryrefslogtreecommitdiff
path: root/lib/vendor-document-list/enhanced-document-service.ts
diff options
context:
space:
mode:
authordujinkim <dujin.kim@dtsolution.co.kr>2025-08-11 09:02:00 +0000
committerdujinkim <dujin.kim@dtsolution.co.kr>2025-08-11 09:02:00 +0000
commitcbb4c7fe0b94459162ad5e998bc05cd293e0ff96 (patch)
tree0a26712f7685e4f6511e637b9a81269d90a47c8f /lib/vendor-document-list/enhanced-document-service.ts
parenteb654f88214095f71be142b989e620fd28db3f69 (diff)
(대표님) 입찰, EDP 변경사항 대응, spreadJS 오류 수정, 벤더실사 수정
Diffstat (limited to 'lib/vendor-document-list/enhanced-document-service.ts')
-rw-r--r--lib/vendor-document-list/enhanced-document-service.ts11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/vendor-document-list/enhanced-document-service.ts b/lib/vendor-document-list/enhanced-document-service.ts
index 28fad74b..d2cec15d 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({ projectId: contracts.projectId })
+ .select({ projectId: contracts.projectId, contractId:contracts.id })
.from(contracts)
.where(eq(contracts.vendorId, companyId))
- const contractIds = vendorContracts.map(c => c.projectId)
+ const contractIds = vendorContracts.map(c => c.contractId)
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.projectId, contractIds),
+ inArray(simplifiedDocumentsView.contractId, contractIds),
advancedWhere,
globalWhere,
)
@@ -1099,9 +1099,8 @@ export async function getDocumentDetails(documentId: number) {
vendorName: vendors.vendorName,
vendorCode: vendors.vendorCode,
})
- .from(contracts)
- .leftJoin(vendors, eq(contracts.vendorId, vendors.id))
- .where(eq(contracts.projectId, contractIds[0]))
+ .from(vendors)
+ .where(eq(vendors.id, companyId))
.limit(1)
return { data, total, drawingKind, vendorInfo }