summaryrefslogtreecommitdiff
path: root/db/schema/generalContract.ts
diff options
context:
space:
mode:
Diffstat (limited to 'db/schema/generalContract.ts')
-rw-r--r--db/schema/generalContract.ts18
1 files changed, 13 insertions, 5 deletions
diff --git a/db/schema/generalContract.ts b/db/schema/generalContract.ts
index 29479b20..6f48581f 100644
--- a/db/schema/generalContract.ts
+++ b/db/schema/generalContract.ts
@@ -47,7 +47,6 @@ export const generalContracts = pgTable('general_contracts', {
// 협력업체 및 계약 기간
// ═══════════════════════════════════════════════════════════════
vendorId: integer('vendor_id').notNull().references(() => vendors.id), // 협력업체 ID
- projectId: integer('project_id').references(() => projects.id), // 프로젝트 ID (nullable)
startDate: date('start_date'), // 계약 시작일
endDate: date('end_date'), // 계약 종료일
validityEndDate: date('validity_end_date'), // 계약 유효기간 종료일
@@ -105,6 +104,8 @@ export const generalContracts = pgTable('general_contracts', {
interlockingSystem: varchar('interlocking_system', { length: 10 }), // 연동제적용 (Y/N)
mandatoryDocuments: jsonb('mandatory_documents').default({}), // 필수문서동의
contractTerminationConditions: jsonb('contract_termination_conditions').default({}), // 계약해지조건
+ externalYardEntry: varchar('external_yard_entry', { length: 1 }), // 사외업체 야드투입 (Y/N)
+ contractAmountReason: text('contract_amount_reason'), // 합의계약 미확정 사유
// ═══════════════════════════════════════════════════════════════
// 기타 계약 조건 및 약관 (JSON 형태)
@@ -117,6 +118,12 @@ export const generalContracts = pgTable('general_contracts', {
offsetDetails: jsonb('offset_details').default({}), // 회입/상계내역
// ═══════════════════════════════════════════════════════════════
+ // 조건검토 의견
+ // ═══════════════════════════════════════════════════════════════
+ vendorComment: text('vendor_comment'), // 협력업체 조건검토 의견
+ shiComment: text('shi_comment'), // 당사 조건검토 의견
+
+ // ═══════════════════════════════════════════════════════════════
// 시스템 관리 정보
// ═══════════════════════════════════════════════════════════════
registeredById: integer('registered_by_id').notNull().references(() => users.id), // 등록자 ID
@@ -133,6 +140,7 @@ export const generalContractItems = pgTable('general_contract_items', {
// ═══════════════════════════════════════════════════════════════
id: serial('id').primaryKey(), // 품목 고유 ID
contractId: integer('contract_id').notNull().references(() => generalContracts.id), // 계약 ID (외래키)
+ projectId: integer('project_id').references(() => projects.id), // 프로젝트 ID (nullable)
// ═══════════════════════════════════════════════════════════════
// 품목 기본 정보
@@ -185,6 +193,10 @@ export const generalContractItemsRelations = relations(generalContractItems, ({
fields: [generalContractItems.contractId],
references: [generalContracts.id],
}),
+ project: one(projects, {
+ fields: [generalContractItems.projectId],
+ references: [projects.id],
+ }),
}));
export const generalContractsRelations = relations(generalContracts, ({ one, many }) => ({
manager: one(users, {
@@ -201,10 +213,6 @@ export const generalContractsRelations = relations(generalContracts, ({ one, man
fields: [generalContracts.vendorId],
references: [vendors.id],
}),
- project: one(projects, {
- fields: [generalContracts.projectId],
- references: [projects.id],
- }),
items: many(generalContractItems),
attachments: many(generalContractAttachments),
}));