75 lines
1.8 KiB
TypeScript
75 lines
1.8 KiB
TypeScript
/**
|
|
* Capacitacion Entity
|
|
* Catálogo de capacitaciones HSE
|
|
*
|
|
* @module HSE
|
|
* @table hse.capacitaciones
|
|
* @ddl schemas/03-hse-schema-ddl.sql
|
|
* @rf RF-MAA017-002
|
|
*/
|
|
|
|
import {
|
|
Entity,
|
|
PrimaryGeneratedColumn,
|
|
Column,
|
|
CreateDateColumn,
|
|
UpdateDateColumn,
|
|
ManyToOne,
|
|
JoinColumn,
|
|
Index,
|
|
} from 'typeorm';
|
|
import { Tenant } from '../../core/entities/tenant.entity';
|
|
|
|
export type TipoCapacitacion = 'induccion' | 'especifica' | 'certificacion' | 'reentrenamiento';
|
|
|
|
@Entity({ schema: 'hse', name: 'capacitaciones' })
|
|
@Index(['tenantId', 'codigo'], { unique: true })
|
|
export class Capacitacion {
|
|
@PrimaryGeneratedColumn('uuid')
|
|
id: string;
|
|
|
|
@Column({ name: 'tenant_id', type: 'uuid' })
|
|
tenantId: string;
|
|
|
|
@Column({ type: 'varchar', length: 20 })
|
|
codigo: string;
|
|
|
|
@Column({ type: 'varchar', length: 200 })
|
|
nombre: string;
|
|
|
|
@Column({ type: 'text', nullable: true })
|
|
descripcion: string;
|
|
|
|
@Column({
|
|
type: 'enum',
|
|
enum: ['induccion', 'especifica', 'certificacion', 'reentrenamiento']
|
|
})
|
|
tipo: TipoCapacitacion;
|
|
|
|
@Column({ name: 'duracion_horas', type: 'integer', default: 1 })
|
|
duracionHoras: number;
|
|
|
|
@Column({ name: 'vigencia_meses', type: 'integer', nullable: true })
|
|
vigenciaMeses: number;
|
|
|
|
@Column({ name: 'requiere_evaluacion', type: 'boolean', default: false })
|
|
requiereEvaluacion: boolean;
|
|
|
|
@Column({ name: 'calificacion_minima', type: 'integer', nullable: true })
|
|
calificacionMinima: number;
|
|
|
|
@Column({ type: 'boolean', default: true })
|
|
activo: boolean;
|
|
|
|
@CreateDateColumn({ name: 'created_at', type: 'timestamptz' })
|
|
createdAt: Date;
|
|
|
|
@UpdateDateColumn({ name: 'updated_at', type: 'timestamptz' })
|
|
updatedAt: Date;
|
|
|
|
// Relations
|
|
@ManyToOne(() => Tenant)
|
|
@JoinColumn({ name: 'tenant_id' })
|
|
tenant: Tenant;
|
|
}
|