diff options
| author | joonhoekim <26rote@gmail.com> | 2025-09-29 16:32:01 +0900 |
|---|---|---|
| committer | joonhoekim <26rote@gmail.com> | 2025-09-29 16:32:01 +0900 |
| commit | 82a2ce067c9b690cdf7775dfb0be94583f51ca29 (patch) | |
| tree | a449c5b82bd41cd28571729cdbb06c5a70a1a8fe /lib/vendor-document-list/plant/shi-buyer-system-api.ts | |
| parent | 921a7672bfb46fb6ed1c6157da3302d31f360139 (diff) | |
(김준회) SWP Document/Drawing List Management 스케줄노트, 보내기 오류 수정
Diffstat (limited to 'lib/vendor-document-list/plant/shi-buyer-system-api.ts')
| -rw-r--r-- | lib/vendor-document-list/plant/shi-buyer-system-api.ts | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/vendor-document-list/plant/shi-buyer-system-api.ts b/lib/vendor-document-list/plant/shi-buyer-system-api.ts index 582490af..80575810 100644 --- a/lib/vendor-document-list/plant/shi-buyer-system-api.ts +++ b/lib/vendor-document-list/plant/shi-buyer-system-api.ts @@ -1,7 +1,7 @@ // app/lib/shi-buyer-system-api.ts import db from "@/db/db" import { stageDocuments, stageIssueStages, contracts, vendors, projects, stageSubmissions, stageSubmissionAttachments } from "@/db/schema" -import { eq, and, sql, ne } from "drizzle-orm" +import { eq, and, sql, ne, or, isNull, inArray } from "drizzle-orm" import fs from 'fs/promises' import path from 'path' @@ -174,7 +174,11 @@ export class ShiBuyerSystemAPI { and( eq(stageDocuments.contractId, contractId), eq(stageDocuments.status, 'ACTIVE'), - ne(stageDocuments.buyerSystemStatus, "승인(DC)") + // ne는 null을 포함하지 않음 + or( + isNull(stageDocuments.buyerSystemStatus), + ne(stageDocuments.buyerSystemStatus, "승인(DC)") + ) ) ) @@ -284,7 +288,7 @@ export class ShiBuyerSystemAPI { syncVersion: sql`sync_version + 1`, lastModifiedBy: 'EVCP' }) - .where(sql`id = ANY(${documentIds})`) + .where(inArray(stageDocuments.id, documentIds)) } private async updateSyncError(contractId: number, errorMessage: string) { @@ -823,7 +827,7 @@ export class ShiBuyerSystemAPI { buyerSystemStatus: status === 'synced' ? 'UPLOADED' : 'PENDING', lastModifiedBy: 'EVCP' }) - .where(sql`id = ANY(${attachmentIds})`) + .where(inArray(stageSubmissionAttachments.id, attachmentIds)) } /** @@ -843,7 +847,7 @@ export class ShiBuyerSystemAPI { if (documentIds.length > 0) { conditions.push( - sql`document_id = ANY(${documentIds.map(d => d.id)})` + inArray(stageSubmissions.documentId, documentIds.map(d => d.id)) ) } } |
