erp-construccion-backend/dist/modules/infonavit/entities/derechohabiente.entity.js

175 lines
7.2 KiB
JavaScript

"use strict";
/**
* Derechohabiente Entity
* Derechohabientes INFONAVIT (trabajadores con crédito)
*
* @module Infonavit
* @table infonavit.derechohabientes
*/
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.Derechohabiente = 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 asignacion_vivienda_entity_1 = require("./asignacion-vivienda.entity");
const historico_puntos_entity_1 = require("./historico-puntos.entity");
let Derechohabiente = class Derechohabiente {
id;
tenantId;
nss;
curp;
rfc;
firstName;
lastName;
secondLastName;
phone;
email;
address;
creditPoints;
precalificationDate;
precalificationAmount;
creditType;
status;
notes;
createdAt;
createdById;
updatedAt;
updatedById;
deletedAt;
deletedById;
// Computed property
get fullName() {
return `${this.firstName} ${this.lastName}${this.secondLastName ? ' ' + this.secondLastName : ''}`;
}
// Relations
tenant;
createdBy;
asignaciones;
historicoPuntos;
};
exports.Derechohabiente = Derechohabiente;
__decorate([
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
__metadata("design:type", String)
], Derechohabiente.prototype, "id", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'tenant_id', type: 'uuid' }),
__metadata("design:type", String)
], Derechohabiente.prototype, "tenantId", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', length: 11 }),
__metadata("design:type", String)
], Derechohabiente.prototype, "nss", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', length: 18 }),
__metadata("design:type", String)
], Derechohabiente.prototype, "curp", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', length: 13, nullable: true }),
__metadata("design:type", String)
], Derechohabiente.prototype, "rfc", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'first_name', type: 'varchar', length: 100 }),
__metadata("design:type", String)
], Derechohabiente.prototype, "firstName", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'last_name', type: 'varchar', length: 100 }),
__metadata("design:type", String)
], Derechohabiente.prototype, "lastName", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'second_last_name', type: 'varchar', length: 100, nullable: true }),
__metadata("design:type", String)
], Derechohabiente.prototype, "secondLastName", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', length: 20, nullable: true }),
__metadata("design:type", String)
], Derechohabiente.prototype, "phone", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
__metadata("design:type", String)
], Derechohabiente.prototype, "email", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
__metadata("design:type", String)
], Derechohabiente.prototype, "address", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'credit_points', type: 'integer', default: 0 }),
__metadata("design:type", Number)
], Derechohabiente.prototype, "creditPoints", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'precalification_date', type: 'date', nullable: true }),
__metadata("design:type", Date)
], Derechohabiente.prototype, "precalificationDate", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'precalification_amount', type: 'decimal', precision: 14, scale: 2, nullable: true }),
__metadata("design:type", Number)
], Derechohabiente.prototype, "precalificationAmount", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'credit_type', type: 'varchar', length: 50, nullable: true }),
__metadata("design:type", String)
], Derechohabiente.prototype, "creditType", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', length: 20, default: 'active' }),
__metadata("design:type", String)
], Derechohabiente.prototype, "status", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
__metadata("design:type", String)
], Derechohabiente.prototype, "notes", void 0);
__decorate([
(0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }),
__metadata("design:type", Date)
], Derechohabiente.prototype, "createdAt", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'created_by', type: 'uuid', nullable: true }),
__metadata("design:type", String)
], Derechohabiente.prototype, "createdById", void 0);
__decorate([
(0, typeorm_1.UpdateDateColumn)({ name: 'updated_at', type: 'timestamptz' }),
__metadata("design:type", Date)
], Derechohabiente.prototype, "updatedAt", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'updated_by', type: 'uuid', nullable: true }),
__metadata("design:type", String)
], Derechohabiente.prototype, "updatedById", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'deleted_at', type: 'timestamptz', nullable: true }),
__metadata("design:type", Date)
], Derechohabiente.prototype, "deletedAt", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'deleted_by', type: 'uuid', nullable: true }),
__metadata("design:type", String)
], Derechohabiente.prototype, "deletedById", 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)
], Derechohabiente.prototype, "tenant", 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)
], Derechohabiente.prototype, "createdBy", void 0);
__decorate([
(0, typeorm_1.OneToMany)(() => asignacion_vivienda_entity_1.AsignacionVivienda, (a) => a.derechohabiente),
__metadata("design:type", Array)
], Derechohabiente.prototype, "asignaciones", void 0);
__decorate([
(0, typeorm_1.OneToMany)(() => historico_puntos_entity_1.HistoricoPuntos, (h) => h.derechohabiente),
__metadata("design:type", Array)
], Derechohabiente.prototype, "historicoPuntos", void 0);
exports.Derechohabiente = Derechohabiente = __decorate([
(0, typeorm_1.Entity)({ schema: 'infonavit', name: 'derechohabientes' }),
(0, typeorm_1.Index)(['tenantId', 'nss'], { unique: true }),
(0, typeorm_1.Index)(['tenantId', 'curp'], { unique: true })
], Derechohabiente);
//# sourceMappingURL=derechohabiente.entity.js.map