diff options
Diffstat (limited to 'lib/bidding/pre-quote/service.ts')
| -rw-r--r-- | lib/bidding/pre-quote/service.ts | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/lib/bidding/pre-quote/service.ts b/lib/bidding/pre-quote/service.ts index b5b06769..35bc8941 100644 --- a/lib/bidding/pre-quote/service.ts +++ b/lib/bidding/pre-quote/service.ts @@ -330,17 +330,20 @@ export async function sendPreQuoteInvitations(companyIds: number[]) { } } // 3. 입찰 상태를 사전견적 요청으로 변경 (bidding_generated 상태에서만) - await tx - .update(biddings) - .set({ - status: 'request_for_quotation', - updatedAt: new Date() - }) - .where(and( - eq(biddings.id, biddingId), - eq(biddings.status, 'bidding_generated') - )) - + for (const company of companiesInfo) { + await db.transaction(async (tx) => { + await tx + .update(biddings) + .set({ + status: 'request_for_quotation', + updatedAt: new Date() + }) + .where(and( + eq(biddings.id, company.biddingId), + eq(biddings.status, 'bidding_generated') + )) + }) + } return { success: true, message: `${companyIds.length}개 업체에 사전견적 초대를 발송했습니다.` @@ -608,7 +611,7 @@ export async function submitPreQuoteResponse( .update(biddings) .set({ status: 'received_quotation', - preQuoteReceivedAt: new Date(), // 사전견적 접수일 업데이트 + preQuoteDate: new Date().toISOString().split('T')[0], // 사전견적 접수일 업데이트 updatedAt: new Date() }) .where(and( |
