task-l
This commit is contained in:
@@ -51,10 +51,41 @@ export const memberships = pgTable('memberships', {
|
||||
role: text('role').default('user').notNull(),
|
||||
businessRole: text('business_role').default('sales_support').notNull(),
|
||||
permissions: text('permissions').array().default([]).notNull(),
|
||||
branchScopeIds: text('branch_scope_ids').array().default([]).notNull(),
|
||||
productTypeScopeIds: text('product_type_scope_ids').array().default([]).notNull(),
|
||||
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
|
||||
updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull()
|
||||
});
|
||||
|
||||
export const crmRoleProfiles = pgTable(
|
||||
'crm_role_profiles',
|
||||
{
|
||||
id: text('id').primaryKey(),
|
||||
organizationId: text('organization_id').notNull(),
|
||||
code: text('code').notNull(),
|
||||
name: text('name').notNull(),
|
||||
description: text('description'),
|
||||
permissions: text('permissions').array().default([]).notNull(),
|
||||
branchScopeMode: text('branch_scope_mode').default('assigned').notNull(),
|
||||
productScopeMode: text('product_scope_mode').default('assigned').notNull(),
|
||||
ownershipScope: text('ownership_scope').default('own').notNull(),
|
||||
approvalAuthority: text('approval_authority').default('none').notNull(),
|
||||
isSystem: boolean('is_system').default(false).notNull(),
|
||||
isActive: boolean('is_active').default(true).notNull(),
|
||||
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
|
||||
updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull(),
|
||||
deletedAt: timestamp('deleted_at', { withTimezone: true }),
|
||||
createdBy: text('created_by').notNull(),
|
||||
updatedBy: text('updated_by').notNull()
|
||||
},
|
||||
(table) => ({
|
||||
organizationRoleCodeIdx: uniqueIndex('crm_role_profiles_org_code_idx').on(
|
||||
table.organizationId,
|
||||
table.code
|
||||
)
|
||||
})
|
||||
);
|
||||
|
||||
export const products = pgTable('products', {
|
||||
id: integer('id').primaryKey().generatedAlwaysAsIdentity(),
|
||||
organizationId: text('organization_id').notNull(),
|
||||
|
||||
Reference in New Issue
Block a user