task h.1 adn fix permission

This commit is contained in:
phaichayon
2026-06-16 15:13:14 +07:00
parent 9ae41e4f2c
commit 90ee59d388
29 changed files with 3807 additions and 119 deletions

View File

@@ -49,7 +49,7 @@ export const memberships = pgTable('memberships', {
userId: text('user_id').notNull(),
organizationId: text('organization_id').notNull(),
role: text('role').default('user').notNull(),
businessRole: text('business_role').default('viewer').notNull(),
businessRole: text('business_role').default('sales_support').notNull(),
permissions: text('permissions').array().default([]).notNull(),
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull()
@@ -215,6 +215,10 @@ export const crmEnquiries = pgTable(
notes: text('notes'),
isHotProject: boolean('is_hot_project').default(false).notNull(),
isActive: boolean('is_active').default(true).notNull(),
assignedToUserId: text('assigned_to_user_id'),
assignedAt: timestamp('assigned_at', { withTimezone: true }),
assignedBy: text('assigned_by'),
assignmentRemark: text('assignment_remark'),
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull(),
deletedAt: timestamp('deleted_at', { withTimezone: true }),
@@ -541,10 +545,9 @@ export const crmDocumentTemplateMappings = pgTable(
deletedAt: timestamp('deleted_at', { withTimezone: true })
},
(table) => ({
templatePlaceholderIdx: uniqueIndex('crm_document_template_mappings_version_placeholder_idx').on(
table.templateVersionId,
table.placeholderKey
)
templatePlaceholderIdx: uniqueIndex(
'crm_document_template_mappings_version_placeholder_idx'
).on(table.templateVersionId, table.placeholderKey)
})
);