summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authordujinkim <dujin.kim@dtsolution.co.kr>2025-11-12 10:42:36 +0000
committerdujinkim <dujin.kim@dtsolution.co.kr>2025-11-12 10:42:36 +0000
commit8642ee064ddf96f1db2b948b4cc8bbbd6cfee820 (patch)
tree36bd57d147ba929f1d72918d1fb91ad2c4778624 /db
parent57ea2f740abf1c7933671561cfe0e421fb5ef3fc (diff)
(최겸) 구매 일반계약, 입찰 수정
Diffstat (limited to 'db')
-rw-r--r--db/schema/bidding.ts18
1 files changed, 14 insertions, 4 deletions
diff --git a/db/schema/bidding.ts b/db/schema/bidding.ts
index 18699633..c8382ea6 100644
--- a/db/schema/bidding.ts
+++ b/db/schema/bidding.ts
@@ -10,6 +10,7 @@ import {
decimal,
boolean,
pgEnum,
+ jsonb,
date,
} from 'drizzle-orm/pg-core'
import { Vendor, vendors } from './vendors'
@@ -100,10 +101,10 @@ export const invitationStatusLabels: Record<string, string> = {
pre_quote_declined: '사전견적 미참여',
pre_quote_submitted: '사전견적제출완료',
bidding_sent: '입찰 초대 발송',
- bidding_accepted: '입찰 참여',
- bidding_declined: '입찰 미참여',
+ bidding_accepted: '응찰',
+ bidding_declined: '응찰 포기',
bidding_cancelled: '응찰 취소',
- bidding_submitted: '응찰 완료'
+ bidding_submitted: '최종 응찰'
}
// 6. 문서 타입 enum
@@ -120,6 +121,7 @@ export const documentTypeEnum = pgEnum('document_type', [
'spec_document', // SPEC 문서
'evaluation_doc', // 평가 관련 문서
'bid_attachment', // 입찰 첨부파일
+ 'selection_result', // 선정결과 첨부파일
'other' // 기타
])
@@ -214,6 +216,11 @@ export const biddings = pgTable('biddings', {
createdAt: timestamp('created_at').defaultNow().notNull(),
updatedAt: timestamp('updated_at').defaultNow().notNull(), // 최종수정일
updatedBy: varchar('updated_by', { length: 100 }), // 최종수정자
+
+ // 개찰 정보
+ openedAt: timestamp('opened_at'), // 개찰일
+ openedBy: varchar('opened_by', { length: 100 }), // 개찰자
+
ANFNR: varchar({length: 50}).unique(), // 원본 ANFNR 추적을 위한 Bidding/RFQ Number (ECC), onConflict target이므로 unique 처리
})
@@ -384,6 +391,9 @@ export const biddingCompanies = pgTable('bidding_companies', {
finalQuoteAmount: decimal('final_quote_amount', { precision: 15, scale: 2 }),
finalQuoteSubmittedAt: timestamp('final_quote_submitted_at'),
isFinalSubmission: boolean('is_final_submission').default(false), // 최종제출 여부
+
+ // 견적 히스토리 스냅샷 (JSON 배열)
+ quotationSnapshots: jsonb('quotation_snapshots'), // 응찰 시점의 품목별 견적 데이터 스냅샷
isWinner: boolean('is_winner'), // 낙찰 여부
isAttendingMeeting: boolean('is_attending_meeting'), // 사양설명회 참석 여부
awardRatio: decimal('award_ratio', { precision: 5, scale: 2 }), // 발주비율
@@ -497,7 +507,7 @@ export const biddingDocuments = pgTable('bidding_documents', {
export const vendorSelectionResults = pgTable('vendor_selection_results', {
id: serial('id').primaryKey(),
biddingId: integer('bidding_id').references(() => biddings.id).notNull(),
- selectedCompanyId: integer('selected_company_id').references(() => vendors.id).notNull(),
+ selectedCompanyId: integer('selected_company_id').references(() => vendors.id), // null이면 전체 선정결과
// 선정 사유 및 결과
selectionReason: text('selection_reason').notNull(), // 선정 사유