"use strict"; /** * Incidente Entity * Gestión de incidentes de seguridad * * @module HSE * @table hse.incidentes * @ddl schemas/03-hse-schema-ddl.sql * @rf RF-MAA017-001 */ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Incidente = void 0; const typeorm_1 = require("typeorm"); const tenant_entity_1 = require("../../core/entities/tenant.entity"); const user_entity_1 = require("../../core/entities/user.entity"); const fraccionamiento_entity_1 = require("../../construction/entities/fraccionamiento.entity"); const incidente_involucrado_entity_1 = require("./incidente-involucrado.entity"); const incidente_accion_entity_1 = require("./incidente-accion.entity"); let Incidente = class Incidente { id; tenantId; folio; fechaHora; fraccionamientoId; ubicacionDescripcion; ubicacionGeo; tipo; gravedad; descripcion; causaInmediata; causaBasica; estado; createdAt; updatedAt; createdById; // Relations tenant; fraccionamiento; createdBy; involucrados; acciones; }; exports.Incidente = Incidente; __decorate([ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'), __metadata("design:type", String) ], Incidente.prototype, "id", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'tenant_id', type: 'uuid' }), __metadata("design:type", String) ], Incidente.prototype, "tenantId", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'varchar', length: 20 }), __metadata("design:type", String) ], Incidente.prototype, "folio", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'fecha_hora', type: 'timestamptz' }), __metadata("design:type", Date) ], Incidente.prototype, "fechaHora", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'fraccionamiento_id', type: 'uuid' }), __metadata("design:type", String) ], Incidente.prototype, "fraccionamientoId", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'ubicacion_descripcion', type: 'text', nullable: true }), __metadata("design:type", String) ], Incidente.prototype, "ubicacionDescripcion", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'ubicacion_geo', type: 'geometry', spatialFeatureType: 'Point', srid: 4326, nullable: true }), __metadata("design:type", String) ], Incidente.prototype, "ubicacionGeo", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'enum', enum: ['accidente', 'incidente', 'casi_accidente'] }), __metadata("design:type", String) ], Incidente.prototype, "tipo", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'enum', enum: ['leve', 'moderado', 'grave', 'fatal'] }), __metadata("design:type", String) ], Incidente.prototype, "gravedad", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'text' }), __metadata("design:type", String) ], Incidente.prototype, "descripcion", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'causa_inmediata', type: 'text', nullable: true }), __metadata("design:type", String) ], Incidente.prototype, "causaInmediata", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'causa_basica', type: 'text', nullable: true }), __metadata("design:type", String) ], Incidente.prototype, "causaBasica", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'enum', enum: ['abierto', 'en_investigacion', 'cerrado'], default: 'abierto' }), __metadata("design:type", String) ], Incidente.prototype, "estado", void 0); __decorate([ (0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }), __metadata("design:type", Date) ], Incidente.prototype, "createdAt", void 0); __decorate([ (0, typeorm_1.UpdateDateColumn)({ name: 'updated_at', type: 'timestamptz' }), __metadata("design:type", Date) ], Incidente.prototype, "updatedAt", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'created_by', type: 'uuid', nullable: true }), __metadata("design:type", String) ], Incidente.prototype, "createdById", void 0); __decorate([ (0, typeorm_1.ManyToOne)(() => tenant_entity_1.Tenant), (0, typeorm_1.JoinColumn)({ name: 'tenant_id' }), __metadata("design:type", tenant_entity_1.Tenant) ], Incidente.prototype, "tenant", void 0); __decorate([ (0, typeorm_1.ManyToOne)(() => fraccionamiento_entity_1.Fraccionamiento), (0, typeorm_1.JoinColumn)({ name: 'fraccionamiento_id' }), __metadata("design:type", fraccionamiento_entity_1.Fraccionamiento) ], Incidente.prototype, "fraccionamiento", void 0); __decorate([ (0, typeorm_1.ManyToOne)(() => user_entity_1.User), (0, typeorm_1.JoinColumn)({ name: 'created_by' }), __metadata("design:type", user_entity_1.User) ], Incidente.prototype, "createdBy", void 0); __decorate([ (0, typeorm_1.OneToMany)(() => incidente_involucrado_entity_1.IncidenteInvolucrado, (ii) => ii.incidente), __metadata("design:type", Array) ], Incidente.prototype, "involucrados", void 0); __decorate([ (0, typeorm_1.OneToMany)(() => incidente_accion_entity_1.IncidenteAccion, (ia) => ia.incidente), __metadata("design:type", Array) ], Incidente.prototype, "acciones", void 0); exports.Incidente = Incidente = __decorate([ (0, typeorm_1.Entity)({ schema: 'hse', name: 'incidentes' }), (0, typeorm_1.Index)(['tenantId', 'folio'], { unique: true }) ], Incidente); //# sourceMappingURL=incidente.entity.js.map