feat(CC-064): add contracts, obligations, pipelineDeals to Drizzle schema
This commit is contained in:
parent
035b71108b
commit
c3ecab8259
1 changed files with 66 additions and 0 deletions
|
|
@ -721,3 +721,69 @@ export const projects = pgTable('projects', {
|
|||
updatedAt: timestamp('updated_at').defaultNow().notNull(),
|
||||
deletedAt: timestamp('deleted_at'),
|
||||
});
|
||||
|
||||
|
||||
// ============================================================
|
||||
// Contracts
|
||||
// ============================================================
|
||||
export const contracts = pgTable('contracts', {
|
||||
id: uuid('id').defaultRandom().primaryKey(),
|
||||
tenantId: uuid('tenant_id').notNull(),
|
||||
workspaceId: uuid('workspace_id'),
|
||||
organizationId: uuid('organization_id'),
|
||||
title: text('title').notNull(),
|
||||
contractType: text('contract_type').notNull().default('other'),
|
||||
status: text('status').notNull().default('draft'),
|
||||
parties: text('parties').array().notNull().default([]),
|
||||
startDate: text('start_date'),
|
||||
endDate: text('end_date'),
|
||||
valueMinorUnits: integer('value_minor_units'),
|
||||
currency: text('currency').default('RON'),
|
||||
notes: text('notes'),
|
||||
tags: text('tags').array().notNull().default([]),
|
||||
createdAt: timestamp('created_at').defaultNow().notNull(),
|
||||
updatedAt: timestamp('updated_at').defaultNow().notNull(),
|
||||
deletedAt: timestamp('deleted_at'),
|
||||
});
|
||||
|
||||
// ============================================================
|
||||
// Obligations (Deadlines & Obligations)
|
||||
// ============================================================
|
||||
export const obligations = pgTable('obligations', {
|
||||
id: uuid('id').defaultRandom().primaryKey(),
|
||||
tenantId: uuid('tenant_id').notNull(),
|
||||
workspaceId: uuid('workspace_id'),
|
||||
title: text('title').notNull(),
|
||||
description: text('description'),
|
||||
category: text('category').notNull().default('contractual'),
|
||||
status: text('status').notNull().default('pending'),
|
||||
dueDate: text('due_date'),
|
||||
owner: text('owner'),
|
||||
contractId: uuid('contract_id'),
|
||||
evidenceUrl: text('evidence_url'),
|
||||
riskLevel: text('risk_level').notNull().default('medium'),
|
||||
createdAt: timestamp('created_at').defaultNow().notNull(),
|
||||
updatedAt: timestamp('updated_at').defaultNow().notNull(),
|
||||
});
|
||||
|
||||
// ============================================================
|
||||
// Pipeline Deals (Sales Pipeline)
|
||||
// ============================================================
|
||||
export const pipelineDeals = pgTable('pipeline_deals', {
|
||||
id: uuid('id').defaultRandom().primaryKey(),
|
||||
tenantId: uuid('tenant_id').notNull(),
|
||||
workspaceId: uuid('workspace_id'),
|
||||
organizationId: uuid('organization_id'),
|
||||
contactId: uuid('contact_id'),
|
||||
title: text('title').notNull(),
|
||||
stage: text('stage').notNull().default('identified'),
|
||||
valueMinorUnits: integer('value_minor_units'),
|
||||
currency: text('currency').default('RON'),
|
||||
probability: integer('probability').default(50),
|
||||
expectedCloseDate: text('expected_close_date'),
|
||||
notes: text('notes'),
|
||||
tags: text('tags').array().notNull().default([]),
|
||||
createdAt: timestamp('created_at').defaultNow().notNull(),
|
||||
updatedAt: timestamp('updated_at').defaultNow().notNull(),
|
||||
deletedAt: timestamp('deleted_at'),
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue