From 6c11fccc84f4c84fa72ee01f9caad9f76f35cea2 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Tue, 16 Sep 2025 09:20:58 +0000 Subject: (대표님, 최겸) 계약, 업로드 관련, 메뉴처리, 입찰, 프리쿼트, rfqLast관련, tbeLast관련 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bidding/detail/service.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'lib/bidding/detail/service.ts') 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, -- cgit v1.2.3