erp-construccion-backend/dist/modules/hr/entities/puesto.entity.js

97 lines
3.6 KiB
JavaScript

"use strict";
/**
* Puesto Entity
* Catálogo de puestos de trabajo
*
* @module HR
* @table hr.puestos
* @ddl schemas/02-hr-schema-ddl.sql
*/
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.Puesto = void 0;
const typeorm_1 = require("typeorm");
const tenant_entity_1 = require("../../core/entities/tenant.entity");
const employee_entity_1 = require("./employee.entity");
let Puesto = class Puesto {
id;
tenantId;
codigo;
nombre;
descripcion;
nivelRiesgo;
requiereCapacitacionEspecial;
activo;
createdAt;
updatedAt;
// Relations
tenant;
empleados;
};
exports.Puesto = Puesto;
__decorate([
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
__metadata("design:type", String)
], Puesto.prototype, "id", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'tenant_id', type: 'uuid' }),
__metadata("design:type", String)
], Puesto.prototype, "tenantId", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', length: 20 }),
__metadata("design:type", String)
], Puesto.prototype, "codigo", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', length: 100 }),
__metadata("design:type", String)
], Puesto.prototype, "nombre", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
__metadata("design:type", String)
], Puesto.prototype, "descripcion", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'nivel_riesgo', type: 'varchar', length: 20, nullable: true }),
__metadata("design:type", String)
], Puesto.prototype, "nivelRiesgo", void 0);
__decorate([
(0, typeorm_1.Column)({
name: 'requiere_capacitacion_especial',
type: 'boolean',
default: false
}),
__metadata("design:type", Boolean)
], Puesto.prototype, "requiereCapacitacionEspecial", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'boolean', default: true }),
__metadata("design:type", Boolean)
], Puesto.prototype, "activo", void 0);
__decorate([
(0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }),
__metadata("design:type", Date)
], Puesto.prototype, "createdAt", void 0);
__decorate([
(0, typeorm_1.UpdateDateColumn)({ name: 'updated_at', type: 'timestamptz' }),
__metadata("design:type", Date)
], Puesto.prototype, "updatedAt", 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)
], Puesto.prototype, "tenant", void 0);
__decorate([
(0, typeorm_1.OneToMany)(() => employee_entity_1.Employee, (e) => e.puesto),
__metadata("design:type", Array)
], Puesto.prototype, "empleados", void 0);
exports.Puesto = Puesto = __decorate([
(0, typeorm_1.Entity)({ schema: 'hr', name: 'puestos' }),
(0, typeorm_1.Index)(['tenantId', 'codigo'], { unique: true })
], Puesto);
//# sourceMappingURL=puesto.entity.js.map