diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-11-19 09:24:58 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-11-19 09:24:58 +0000 |
| commit | 0d68dbcba27ce49c15f30126f7a5dfce974847a3 (patch) | |
| tree | f00f71a2c33f0110fc2ef9e1243b47719ab5c316 /lib/bidding/detail/service.ts | |
| parent | 60382940bac4ac8309be64be16f4774b6820df22 (diff) | |
(최겸) 구매 입찰 발주비율 취소기능 추가 등
Diffstat (limited to 'lib/bidding/detail/service.ts')
| -rw-r--r-- | lib/bidding/detail/service.ts | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/bidding/detail/service.ts b/lib/bidding/detail/service.ts index b5a3cce8..6ab9270e 100644 --- a/lib/bidding/detail/service.ts +++ b/lib/bidding/detail/service.ts @@ -610,6 +610,40 @@ export async function updateBiddingDetailVendor( } } +// 발주비율 취소 (발주비율을 null로 리셋하고 낙찰 상태 해제) +export async function cancelAwardRatio(biddingCompanyId: number) { + try { + const result = await db.update(biddingCompanies) + .set({ + awardRatio: null, + isWinner: false, + updatedAt: new Date(), + }) + .where(eq(biddingCompanies.id, biddingCompanyId)) + .returning({ biddingId: biddingCompanies.biddingId }) + + // 캐시 무효화 + if (result.length > 0) { + const biddingId = result[0].biddingId + revalidateTag(`bidding-${biddingId}`) + revalidateTag('quotation-vendors') + revalidateTag('quotation-details') + revalidatePath(`/evcp/bid/${biddingId}`) + } + + return { + success: true, + message: '발주비율이 성공적으로 취소되었습니다.', + } + } catch (error) { + console.error('Failed to cancel award ratio:', error) + return { + success: false, + error: error instanceof Error ? error.message : '발주비율 취소에 실패했습니다.' + } + } +} + // 본입찰용 업체 추가 export async function createBiddingDetailVendor( biddingId: number, |
