diff options
Diffstat (limited to 'lib/bidding/service.ts')
| -rw-r--r-- | lib/bidding/service.ts | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/bidding/service.ts b/lib/bidding/service.ts index 453989c1..77a0b1b4 100644 --- a/lib/bidding/service.ts +++ b/lib/bidding/service.ts @@ -848,7 +848,7 @@ export async function createBidding(input: CreateBiddingInput, userId: string) { .insert(biddings) .values({ biddingNumber, - originalBiddingNumber: null, // 원입찰번호는 초기 생성이므로 아직 없음 + originalBiddingNumber: biddingNumber.split('-')[0], revision: input.revision || 0, // 프로젝트 정보 (PR 아이템에서 설정됨) @@ -2873,10 +2873,13 @@ export async function increaseRoundOrRebid(biddingId: number, userId: string | u // 2. 입찰번호 생성 (타입에 따라 다르게 처리) let newBiddingNumber: string + let originalBiddingNumber: string if (type === 'rebidding') { // 재입찰: 완전히 새로운 입찰번호 생성 newBiddingNumber = await generateBiddingNumber(existingBidding.contractType, userId, tx) + // 재입찰시에도 원입찰번호는 새로 생성된 입찰번호로 셋팅 + originalBiddingNumber = newBiddingNumber.split('-')[0] } else { // 차수증가: 기존 입찰번호에서 차수 증가 const currentBiddingNumber = existingBidding.biddingNumber @@ -2888,14 +2891,16 @@ export async function increaseRoundOrRebid(biddingId: number, userId: string | u if (currentRound >= 3) { // -03 이상이면 새로운 번호 생성 newBiddingNumber = await generateBiddingNumber(existingBidding.contractType, userId, tx) + // 새로 생성한 입찰번호를 원입찰번호로 셋팅 + originalBiddingNumber = newBiddingNumber.split('-')[0] } else { // -02까지는 차수만 증가 const baseNumber = currentBiddingNumber.split('-')[0] newBiddingNumber = `${baseNumber}-${String(currentRound + 1).padStart(2, '0')}` + // 차수증가의 경우에도 원입찰번호는 새로 생성한 입찰번호로 셋팅 + originalBiddingNumber = newBiddingNumber.split('-')[0] } } - //원입찰번호는 -0n 제외하고 저장 - const originalBiddingNumber = existingBidding.biddingNumber.split('-')[0] // 3. 새로운 입찰 생성 (기존 정보 복제) const [newBidding] = await tx |
