/** * Checklist Entity * Plantillas de verificación de calidad * * @module Construction * @table construction.checklists * @ddl schemas/01-construction-schema-ddl.sql */ import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, ManyToOne, OneToMany, JoinColumn, Index, } from 'typeorm'; import { Prototipo } from './prototipo.entity'; import { ChecklistItem } from './checklist-item.entity'; @Entity({ schema: 'construction', name: 'checklists' }) @Index(['tenantId', 'code'], { unique: true }) @Index(['tenantId']) export class Checklist { @PrimaryGeneratedColumn('uuid') id: string; @Column({ name: 'tenant_id', type: 'uuid' }) tenantId: string; @Column({ type: 'varchar', length: 30 }) code: string; @Column({ type: 'varchar', length: 255 }) name: string; @Column({ type: 'text', nullable: true }) description: string; @Column({ name: 'prototipo_id', type: 'uuid', nullable: true }) prototipoId: string; @Column({ name: 'is_active', type: 'boolean', default: true }) isActive: boolean; @CreateDateColumn({ name: 'created_at', type: 'timestamptz' }) createdAt: Date; @Column({ name: 'created_by', type: 'uuid', nullable: true }) createdBy: string; @UpdateDateColumn({ name: 'updated_at', type: 'timestamptz', nullable: true }) updatedAt: Date; @Column({ name: 'updated_by', type: 'uuid', nullable: true }) updatedBy: string; @Column({ name: 'deleted_at', type: 'timestamptz', nullable: true }) deletedAt: Date; @Column({ name: 'deleted_by', type: 'uuid', nullable: true }) deletedBy: string; // Relations @ManyToOne(() => Prototipo) @JoinColumn({ name: 'prototipo_id' }) prototipo: Prototipo; @OneToMany(() => ChecklistItem, (item) => item.checklist) items: ChecklistItem[]; }