Modules added: - audit (7 entities): audit logs, config changes, entity changes - billing-usage (14 entities): subscriptions, invoices, coupons - core (13 entities): countries, currencies, UoMs, sequences - invoices (4 entities): invoices, payments, allocations - notifications (6 entities): notifications, templates, channels Total: 44 new entity files Build: Clean (0 TypeScript errors) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
51 lines
1.0 KiB
TypeScript
51 lines
1.0 KiB
TypeScript
/**
|
|
* Tenant Entity
|
|
* Entidad para multi-tenancy
|
|
*
|
|
* @module Core
|
|
* @table core.tenants
|
|
*/
|
|
|
|
import {
|
|
Entity,
|
|
PrimaryGeneratedColumn,
|
|
Column,
|
|
CreateDateColumn,
|
|
UpdateDateColumn,
|
|
OneToMany,
|
|
Index,
|
|
} from 'typeorm';
|
|
import { User } from './user.entity';
|
|
|
|
@Entity({ schema: 'auth', name: 'tenants' })
|
|
export class Tenant {
|
|
@PrimaryGeneratedColumn('uuid')
|
|
id: string;
|
|
|
|
@Column({ type: 'varchar', length: 50, unique: true })
|
|
@Index()
|
|
code: string;
|
|
|
|
@Column({ type: 'varchar', length: 200 })
|
|
name: string;
|
|
|
|
@Column({ name: 'is_active', type: 'boolean', default: true })
|
|
isActive: boolean;
|
|
|
|
@Column({ type: 'jsonb', default: {} })
|
|
settings: Record<string, unknown>;
|
|
|
|
@CreateDateColumn({ name: 'created_at', type: 'timestamptz' })
|
|
createdAt: Date;
|
|
|
|
@UpdateDateColumn({ name: 'updated_at', type: 'timestamptz' })
|
|
updatedAt: Date;
|
|
|
|
@Column({ name: 'deleted_at', type: 'timestamptz', nullable: true })
|
|
deletedAt: Date;
|
|
|
|
// Relations
|
|
@OneToMany(() => User, (user) => user.tenant)
|
|
users: User[];
|
|
}
|