diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-09-16 09:20:58 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-09-16 09:20:58 +0000 |
| commit | 6c11fccc84f4c84fa72ee01f9caad9f76f35cea2 (patch) | |
| tree | fa88d10ea7d21fe6b59ed0c1569856a73d56547a /lib/bidding/detail/service.ts | |
| parent | 14e3990aba7e1ad1cdd0965cbd167c50230cbfbf (diff) | |
(대표님, 최겸) 계약, 업로드 관련, 메뉴처리, 입찰, 프리쿼트, rfqLast관련, tbeLast관련
Diffstat (limited to 'lib/bidding/detail/service.ts')
| -rw-r--r-- | lib/bidding/detail/service.ts | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/bidding/detail/service.ts b/lib/bidding/detail/service.ts index df8427da..b00a4f4f 100644 --- a/lib/bidding/detail/service.ts +++ b/lib/bidding/detail/service.ts @@ -632,7 +632,7 @@ export async function createBiddingDetailVendor( companyId: vendorId, invitationStatus: 'pending', isPreQuoteSelected: true, // 본입찰 등록 기본값 - isWinner: false, + isWinner: null, // 미정 상태로 초기화 0916 createdAt: new Date(), updatedAt: new Date(), }).returning({ id: biddingCompanies.id }) @@ -679,13 +679,23 @@ export async function createQuotationVendor(input: any, userId: string) { try { const userName = await getUserNameById(userId) const result = await db.transaction(async (tx) => { + // 0. 중복 체크 - 이미 해당 입찰에 참여중인 업체인지 확인 + const existingCompany = await tx + .select() + .from(biddingCompanies) + .where(sql`${biddingCompanies.biddingId} = ${input.biddingId} AND ${biddingCompanies.companyId} = ${input.companyId}`) + + if (existingCompany.length > 0) { + throw new Error('이미 등록된 업체입니다') + } + // 1. biddingCompanies에 레코드 생성 const biddingCompanyResult = await tx.insert(biddingCompanies).values({ biddingId: input.biddingId, companyId: input.vendorId, finalQuoteAmount: input.quotationAmount?.toString(), awardRatio: input.awardRatio?.toString(), - isWinner: false, + isWinner: null, // 미정 상태로 초기화 contactPerson: input.contactPerson, contactEmail: input.contactEmail, contactPhone: input.contactPhone, |
