erp-construccion-backend/dist/modules/estimates/entities/estimacion-concepto.entity.js

173 lines
7.1 KiB
JavaScript

"use strict";
/**
* EstimacionConcepto Entity
* Lineas de concepto por estimacion
*
* @module Estimates
* @table estimates.estimacion_conceptos
* @ddl schemas/04-estimates-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.EstimacionConcepto = 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 concepto_entity_1 = require("../../budgets/entities/concepto.entity");
const estimacion_entity_1 = require("./estimacion.entity");
const generador_entity_1 = require("./generador.entity");
let EstimacionConcepto = class EstimacionConcepto {
id;
tenantId;
estimacionId;
conceptoId;
contratoPartidaId;
quantityContract;
quantityPrevious;
quantityCurrent;
// Columna calculada (GENERATED ALWAYS AS) - solo lectura
quantityAccumulated;
unitPrice;
// Columna calculada (GENERATED ALWAYS AS) - solo lectura
amountCurrent;
notes;
createdAt;
createdById;
updatedAt;
updatedById;
deletedAt;
deletedById;
// Relations
tenant;
estimacion;
concepto;
createdBy;
generadores;
};
exports.EstimacionConcepto = EstimacionConcepto;
__decorate([
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
__metadata("design:type", String)
], EstimacionConcepto.prototype, "id", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'tenant_id', type: 'uuid' }),
__metadata("design:type", String)
], EstimacionConcepto.prototype, "tenantId", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'estimacion_id', type: 'uuid' }),
__metadata("design:type", String)
], EstimacionConcepto.prototype, "estimacionId", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'concepto_id', type: 'uuid' }),
__metadata("design:type", String)
], EstimacionConcepto.prototype, "conceptoId", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'contrato_partida_id', type: 'uuid', nullable: true }),
__metadata("design:type", Object)
], EstimacionConcepto.prototype, "contratoPartidaId", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'quantity_contract', type: 'decimal', precision: 12, scale: 4, default: 0 }),
__metadata("design:type", Number)
], EstimacionConcepto.prototype, "quantityContract", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'quantity_previous', type: 'decimal', precision: 12, scale: 4, default: 0 }),
__metadata("design:type", Number)
], EstimacionConcepto.prototype, "quantityPrevious", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'quantity_current', type: 'decimal', precision: 12, scale: 4, default: 0 }),
__metadata("design:type", Number)
], EstimacionConcepto.prototype, "quantityCurrent", void 0);
__decorate([
(0, typeorm_1.Column)({
name: 'quantity_accumulated',
type: 'decimal',
precision: 12,
scale: 4,
insert: false,
update: false,
}),
__metadata("design:type", Number)
], EstimacionConcepto.prototype, "quantityAccumulated", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'unit_price', type: 'decimal', precision: 12, scale: 4, default: 0 }),
__metadata("design:type", Number)
], EstimacionConcepto.prototype, "unitPrice", void 0);
__decorate([
(0, typeorm_1.Column)({
name: 'amount_current',
type: 'decimal',
precision: 14,
scale: 2,
insert: false,
update: false,
}),
__metadata("design:type", Number)
], EstimacionConcepto.prototype, "amountCurrent", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
__metadata("design:type", Object)
], EstimacionConcepto.prototype, "notes", void 0);
__decorate([
(0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }),
__metadata("design:type", Date)
], EstimacionConcepto.prototype, "createdAt", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'created_by', type: 'uuid', nullable: true }),
__metadata("design:type", Object)
], EstimacionConcepto.prototype, "createdById", void 0);
__decorate([
(0, typeorm_1.UpdateDateColumn)({ name: 'updated_at', type: 'timestamptz', nullable: true }),
__metadata("design:type", Object)
], EstimacionConcepto.prototype, "updatedAt", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'updated_by', type: 'uuid', nullable: true }),
__metadata("design:type", Object)
], EstimacionConcepto.prototype, "updatedById", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'deleted_at', type: 'timestamptz', nullable: true }),
__metadata("design:type", Object)
], EstimacionConcepto.prototype, "deletedAt", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'deleted_by', type: 'uuid', nullable: true }),
__metadata("design:type", Object)
], EstimacionConcepto.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)
], EstimacionConcepto.prototype, "tenant", void 0);
__decorate([
(0, typeorm_1.ManyToOne)(() => estimacion_entity_1.Estimacion, (e) => e.conceptos),
(0, typeorm_1.JoinColumn)({ name: 'estimacion_id' }),
__metadata("design:type", estimacion_entity_1.Estimacion)
], EstimacionConcepto.prototype, "estimacion", void 0);
__decorate([
(0, typeorm_1.ManyToOne)(() => concepto_entity_1.Concepto),
(0, typeorm_1.JoinColumn)({ name: 'concepto_id' }),
__metadata("design:type", concepto_entity_1.Concepto)
], EstimacionConcepto.prototype, "concepto", void 0);
__decorate([
(0, typeorm_1.ManyToOne)(() => user_entity_1.User),
(0, typeorm_1.JoinColumn)({ name: 'created_by' }),
__metadata("design:type", Object)
], EstimacionConcepto.prototype, "createdBy", void 0);
__decorate([
(0, typeorm_1.OneToMany)(() => generador_entity_1.Generador, (g) => g.estimacionConcepto),
__metadata("design:type", Array)
], EstimacionConcepto.prototype, "generadores", void 0);
exports.EstimacionConcepto = EstimacionConcepto = __decorate([
(0, typeorm_1.Entity)({ schema: 'estimates', name: 'estimacion_conceptos' }),
(0, typeorm_1.Index)(['estimacionId', 'conceptoId'], { unique: true }),
(0, typeorm_1.Index)(['tenantId']),
(0, typeorm_1.Index)(['estimacionId']),
(0, typeorm_1.Index)(['conceptoId'])
], EstimacionConcepto);
//# sourceMappingURL=estimacion-concepto.entity.js.map