erp-transportistas-backend-v2/src/modules/settings/entities/tenant-setting.entity.ts
Adrian Flores Cortes ec59053bbe feat: Propagate entities from erp-construccion
Modules added (entities only):
- biometrics (4 entities)
- feature-flags (3 entities)
- hr (8 entities)
- invoices (4 entities)
- products (7 entities)
- profiles (5 entities)
- projects (1 entity)
- purchase (11 entities)
- reports (13 entities)
- sales (4 entities)
- settings (4 entities)
- storage (7 entities)
- warehouses (3 entities)
- webhooks (6 entities)
- whatsapp (10 entities)

Total: 90 new entity files
Source: erp-construccion (validated, build clean)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 09:06:31 -06:00

54 lines
1.2 KiB
TypeScript

/**
* Tenant Setting Entity
* Custom configuration per tenant, overrides system and plan defaults
* Hierarchy: system_settings < plan_settings < tenant_settings
* Compatible with erp-core tenant-setting.entity
*
* @module Settings
*/
import {
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
Index,
Unique,
} from 'typeorm';
@Entity({ name: 'tenant_settings', schema: 'core_settings' })
@Unique(['tenantId', 'key'])
export class TenantSetting {
@PrimaryGeneratedColumn('uuid')
id: string;
@Index()
@Column({ name: 'tenant_id', type: 'uuid' })
tenantId: string;
@Index()
@Column({ name: 'key', type: 'varchar', length: 100 })
key: string;
@Column({ name: 'value', type: 'jsonb' })
value: any;
@Column({
name: 'inherited_from',
type: 'varchar',
length: 20,
default: 'custom',
})
inheritedFrom: 'system' | 'plan' | 'custom';
@Column({ name: 'is_overridden', type: 'boolean', default: true })
isOverridden: boolean;
@CreateDateColumn({ name: 'created_at', type: 'timestamptz' })
createdAt: Date;
@UpdateDateColumn({ name: 'updated_at', type: 'timestamptz' })
updatedAt: Date;
}