task-d5.5.1

This commit is contained in:
phaichayon
2026-06-25 12:16:41 +07:00
parent f2c7156851
commit c2a74b6764
121 changed files with 3407 additions and 2679 deletions

View File

@@ -325,8 +325,8 @@ export const crmContactShares = pgTable(
})
);
export const crmEnquiries = pgTable(
'crm_enquiries',
export const crmOpportunities = pgTable(
'crm_opportunities',
{
id: text('id').primaryKey(),
organizationId: text('organization_id').notNull(),
@@ -374,17 +374,17 @@ export const crmEnquiries = pgTable(
updatedBy: text('updated_by').notNull()
},
(table) => ({
organizationCodeIdx: uniqueIndex('crm_enquiries_org_code_idx').on(
organizationCodeIdx: uniqueIndex('crm_opportunities_org_code_idx').on(
table.organizationId,
table.code
)
})
);
export const crmEnquiryFollowups = pgTable('crm_enquiry_followups', {
export const crmOpportunityFollowups = pgTable('crm_opportunity_followups', {
id: text('id').primaryKey(),
organizationId: text('organization_id').notNull(),
enquiryId: text('enquiry_id').notNull(),
opportunityId: text('opportunity_id').notNull(),
followupDate: timestamp('followup_date', { withTimezone: true }).notNull(),
followupType: text('followup_type').notNull(),
contactId: text('contact_id'),
@@ -399,10 +399,10 @@ export const crmEnquiryFollowups = pgTable('crm_enquiry_followups', {
updatedBy: text('updated_by').notNull()
});
export const crmEnquiryCustomers = pgTable('crm_enquiry_customers', {
export const crmOpportunityCustomers = pgTable('crm_opportunity_customers', {
id: text('id').primaryKey(),
organizationId: text('organization_id').notNull(),
enquiryId: text('enquiry_id').notNull(),
opportunityId: text('opportunity_id').notNull(),
customerId: text('customer_id').notNull(),
role: text('role').notNull(),
remark: text('remark'),
@@ -411,10 +411,10 @@ export const crmEnquiryCustomers = pgTable('crm_enquiry_customers', {
deletedAt: timestamp('deleted_at', { withTimezone: true })
});
export const crmEnquiryAttachments = pgTable('crm_enquiry_attachments', {
export const crmOpportunityAttachments = pgTable('crm_opportunity_attachments', {
id: text('id').primaryKey(),
organizationId: text('organization_id').notNull(),
enquiryId: text('enquiry_id').notNull(),
opportunityId: text('opportunity_id').notNull(),
category: text('category').notNull(),
fileName: text('file_name').notNull(),
originalFileName: text('original_file_name').notNull(),
@@ -459,7 +459,7 @@ export const crmQuotations = pgTable(
organizationId: text('organization_id').notNull(),
branchId: text('branch_id'),
code: text('code').notNull(),
enquiryId: text('enquiry_id'),
opportunityId: text('opportunity_id'),
customerId: text('customer_id').notNull(),
contactId: text('contact_id'),
quotationDate: timestamp('quotation_date', { withTimezone: true }).notNull(),
@@ -804,3 +804,4 @@ export const crmDocumentTemplateTableColumns = pgTable(
)
})
);