summaryrefslogtreecommitdiff
path: root/lib/bidding/pre-quote/service.ts
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bidding/pre-quote/service.ts')
-rw-r--r--lib/bidding/pre-quote/service.ts15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/bidding/pre-quote/service.ts b/lib/bidding/pre-quote/service.ts
index 35bc8941..3f1b916c 100644
--- a/lib/bidding/pre-quote/service.ts
+++ b/lib/bidding/pre-quote/service.ts
@@ -133,6 +133,7 @@ export async function updatePreQuoteSelection(companyIds: number[], isSelected:
await db.update(biddingCompanies)
.set({
isPreQuoteSelected: isSelected,
+ invitationStatus: 'pending', // 초기 상태: 입찰생성
updatedAt: new Date()
})
.where(inArray(biddingCompanies.id, companyIds))
@@ -194,7 +195,9 @@ export async function getBiddingCompanies(biddingId: number) {
respondedAt: biddingCompanies.respondedAt,
preQuoteAmount: biddingCompanies.preQuoteAmount,
preQuoteSubmittedAt: biddingCompanies.preQuoteSubmittedAt,
+ preQuoteDeadline: biddingCompanies.preQuoteDeadline,
isPreQuoteSelected: biddingCompanies.isPreQuoteSelected,
+ isPreQuoteParticipated: biddingCompanies.isPreQuoteParticipated,
isAttendingMeeting: biddingCompanies.isAttendingMeeting,
notes: biddingCompanies.notes,
contactPerson: biddingCompanies.contactPerson,
@@ -217,6 +220,7 @@ export async function getBiddingCompanies(biddingId: number) {
proposedShippingPort: companyConditionResponses.proposedShippingPort,
proposedDestinationPort: companyConditionResponses.proposedDestinationPort,
sparePartResponse: companyConditionResponses.sparePartResponse,
+ additionalProposals: companyConditionResponses.additionalProposals,
})
.from(biddingCompanies)
.leftJoin(
@@ -243,7 +247,7 @@ export async function getBiddingCompanies(biddingId: number) {
}
// 선택된 업체들에게 사전견적 초대 발송
-export async function sendPreQuoteInvitations(companyIds: number[]) {
+export async function sendPreQuoteInvitations(companyIds: number[], preQuoteDeadline?: Date | string) {
try {
if (companyIds.length === 0) {
return {
@@ -292,6 +296,7 @@ export async function sendPreQuoteInvitations(companyIds: number[]) {
.set({
invitationStatus: 'sent', // 사전견적 초대 발송 상태
invitedAt: new Date(),
+ preQuoteDeadline: preQuoteDeadline ? new Date(preQuoteDeadline) : null,
updatedAt: new Date()
})
.where(eq(biddingCompanies.id, id))
@@ -406,7 +411,9 @@ export async function getBiddingCompaniesForPartners(biddingId: number, companyI
invitationStatus: biddingCompanies.invitationStatus,
preQuoteAmount: biddingCompanies.preQuoteAmount,
preQuoteSubmittedAt: biddingCompanies.preQuoteSubmittedAt,
+ preQuoteDeadline: biddingCompanies.preQuoteDeadline,
isPreQuoteSelected: biddingCompanies.isPreQuoteSelected,
+ isPreQuoteParticipated: biddingCompanies.isPreQuoteParticipated,
isAttendingMeeting: biddingCompanies.isAttendingMeeting,
// company_condition_responses 정보
paymentTermsResponse: companyConditionResponses.paymentTermsResponse,
@@ -443,7 +450,9 @@ export async function getBiddingCompaniesForPartners(biddingId: number, companyI
invitationStatus: null,
preQuoteAmount: null,
preQuoteSubmittedAt: null,
+ preQuoteDeadline: null,
isPreQuoteSelected: false,
+ isPreQuoteParticipated: null,
isAttendingMeeting: null,
paymentTermsResponse: null,
taxConditionsResponse: null,
@@ -666,7 +675,7 @@ export async function respondToPreQuoteInvitation(
}
}
-// 벤더에서 사전견적 참여 여부 결정 (isPreQuoteSelected 사용)
+// 벤더에서 사전견적 참여 여부 결정 (isPreQuoteSelected, isPreQuoteParticipated 사용)
export async function setPreQuoteParticipation(
biddingCompanyId: number,
isParticipating: boolean,
@@ -675,8 +684,8 @@ export async function setPreQuoteParticipation(
try {
await db.update(biddingCompanies)
.set({
+ isPreQuoteParticipated: isParticipating,
isPreQuoteSelected: isParticipating,
- invitationStatus: isParticipating ? 'accepted' : 'declined',
respondedAt: new Date(),
updatedAt: new Date()
})