erp-construccion-backend-v2/src/modules/construction/entities/checklist.entity.ts
Adrian Flores Cortes ebc526acb2 [REMEDIATION] feat: Backend remediation - auth controllers, construction entities, storage services
Add 5 auth controllers (device, MFA, permission, role, session), 18 construction entities,
5 storage services, 2 document services. Enhance auth middleware, fix budget/construction
controllers. Addresses gaps from TASK-2026-02-05 analysis.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-05 23:18:17 -06:00

75 lines
1.8 KiB
TypeScript

/**
* 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[];
}