summaryrefslogtreecommitdiff
path: root/lib/bidding/detail/service.ts
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bidding/detail/service.ts')
-rw-r--r--lib/bidding/detail/service.ts69
1 files changed, 53 insertions, 16 deletions
diff --git a/lib/bidding/detail/service.ts b/lib/bidding/detail/service.ts
index b00a4f4f..a603834c 100644
--- a/lib/bidding/detail/service.ts
+++ b/lib/bidding/detail/service.ts
@@ -969,7 +969,7 @@ export async function markAsDisposal(biddingId: number, userId: string) {
// 입찰 등록 (사전견적에서 선정된 업체들에게 본입찰 초대 발송)
export async function registerBidding(biddingId: number, userId: string) {
try {
- // 사전견적에서 선정된 업체들 조회
+ // 사전견적에서 선정된 업체들 + 본입찰에서 개별적으로 추가한 업체들 조회
const selectedCompanies = await db
.select({
companyId: biddingCompanies.companyId,
@@ -1118,18 +1118,18 @@ export async function createRebidding(biddingId: number, userId: string) {
return { success: false, error: '재입찰 업데이트에 실패했습니다.' }
}
- // 참여 업체들의 상태를 대기로 변경
- await db
- .update(biddingCompanies)
- .set({
- isBiddingParticipated: null, // 대기 상태로 변경
- invitationStatus: 'sent',
- updatedAt: new Date()
- })
- .where(and(
- eq(biddingCompanies.biddingId, biddingId),
- eq(biddingCompanies.isBiddingParticipated, true)
- ))
+ // // 참여 업체들의 상태를 대기로 변경
+ // await db
+ // .update(biddingCompanies)
+ // .set({
+ // isBiddingParticipated: null, // 대기 상태로 변경
+ // invitationStatus: 'sent',
+ // updatedAt: new Date()
+ // })
+ // .where(and(
+ // eq(biddingCompanies.biddingId, biddingId),
+ // eq(biddingCompanies.isBiddingParticipated, true)
+ // ))
// 재입찰 안내 메일 발송
for (const company of participantCompanies) {
@@ -1686,6 +1686,7 @@ export interface PartnersBiddingListItem {
isAttendingMeeting: boolean | null
isPreQuoteSelected: boolean | null
isPreQuoteParticipated: boolean | null
+ isBiddingParticipated: boolean | null
preQuoteDeadline: Date | null
isBiddingInvited: boolean | null
notes: string | null
@@ -1702,7 +1703,9 @@ export interface PartnersBiddingListItem {
title: string
contractType: string
biddingType: string
- contractPeriod: string | null
+ preQuoteDate: Date | null
+ contractStartDate: Date | null
+ contractEndDate: Date | null
submissionStartDate: Date | null
submissionEndDate: Date | null
status: string
@@ -1733,6 +1736,7 @@ export async function getBiddingListForPartners(companyId: number): Promise<Part
isAttendingMeeting: biddingCompanies.isAttendingMeeting,
isPreQuoteSelected: biddingCompanies.isPreQuoteSelected,
isPreQuoteParticipated: biddingCompanies.isPreQuoteParticipated,
+ isBiddingParticipated: biddingCompanies.isBiddingParticipated,
preQuoteDeadline: biddingCompanies.preQuoteDeadline,
isBiddingInvited: biddingCompanies.isBiddingInvited,
notes: biddingCompanies.notes,
@@ -1749,7 +1753,9 @@ export async function getBiddingListForPartners(companyId: number): Promise<Part
title: biddings.title,
contractType: biddings.contractType,
biddingType: biddings.biddingType,
- contractPeriod: biddings.contractPeriod,
+ preQuoteDate: biddings.preQuoteDate,
+ contractStartDate: biddings.contractStartDate,
+ contractEndDate: biddings.contractEndDate,
submissionStartDate: biddings.submissionStartDate,
submissionEndDate: biddings.submissionEndDate,
status: biddings.status,
@@ -1810,7 +1816,9 @@ export async function getBiddingDetailsForPartners(biddingId: number, companyId:
contractType: biddings.contractType,
biddingType: biddings.biddingType,
awardCount: biddings.awardCount,
- contractPeriod: biddings.contractPeriod,
+ preQuoteDate: biddings.preQuoteDate,
+ contractStartDate: biddings.contractStartDate,
+ contractEndDate: biddings.contractEndDate,
// 일정 정보
preQuoteDate: biddings.preQuoteDate,
@@ -1841,6 +1849,7 @@ export async function getBiddingDetailsForPartners(biddingId: number, companyId:
isPreQuoteSelected: biddingCompanies.isPreQuoteSelected,
isBiddingParticipated: biddingCompanies.isBiddingParticipated,
isPreQuoteParticipated: biddingCompanies.isPreQuoteParticipated,
+ isBiddingParticipated: biddingCompanies.isBiddingParticipated,
hasSpecificationMeeting: biddings.hasSpecificationMeeting,
// 응답한 조건들 (company_condition_responses) - 제시된 조건과 응답 모두 여기서 관리
paymentTermsResponse: companyConditionResponses.paymentTermsResponse,
@@ -2640,3 +2649,31 @@ export async function getVendorPricesForBidding(biddingId: number) {
}
)()
}
+
+// 사양설명회 참여 여부 업데이트
+export async function setSpecificationMeetingParticipation(biddingCompanyId: number, participated: boolean) {
+ try {
+ const result = await db.update(biddingCompanies)
+ .set({
+ isAttendingMeeting: participated,
+ 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')
+ revalidatePath(`/partners/bid/${biddingId}`)
+ }
+
+ return {
+ success: true,
+ message: `사양설명회 참여상태가 ${participated ? '참여' : '불참'}로 업데이트되었습니다.`,
+ }
+ } catch (error) {
+ console.error('Failed to update specification meeting participation:', error)
+ return { success: false, error: '사양설명회 참여상태 업데이트에 실패했습니다.' }
+ }
+} \ No newline at end of file