137 lines
5.7 KiB
JavaScript
137 lines
5.7 KiB
JavaScript
"use strict";
|
|
/**
|
|
* PresupuestoPartida Entity
|
|
* Lineas/partidas de un presupuesto
|
|
*
|
|
* @module Budgets
|
|
* @table construction.presupuesto_partidas
|
|
* @ddl schemas/01-construction-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.PresupuestoPartida = 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 presupuesto_entity_1 = require("./presupuesto.entity");
|
|
const concepto_entity_1 = require("./concepto.entity");
|
|
let PresupuestoPartida = class PresupuestoPartida {
|
|
id;
|
|
tenantId;
|
|
presupuestoId;
|
|
conceptoId;
|
|
sequence;
|
|
quantity;
|
|
unitPrice;
|
|
// Columna calculada (GENERATED ALWAYS AS) - solo lectura
|
|
totalAmount;
|
|
createdAt;
|
|
createdById;
|
|
updatedAt;
|
|
updatedById;
|
|
deletedAt;
|
|
deletedById;
|
|
// Relations
|
|
tenant;
|
|
presupuesto;
|
|
concepto;
|
|
createdBy;
|
|
};
|
|
exports.PresupuestoPartida = PresupuestoPartida;
|
|
__decorate([
|
|
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
__metadata("design:type", String)
|
|
], PresupuestoPartida.prototype, "id", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'tenant_id', type: 'uuid' }),
|
|
__metadata("design:type", String)
|
|
], PresupuestoPartida.prototype, "tenantId", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'presupuesto_id', type: 'uuid' }),
|
|
__metadata("design:type", String)
|
|
], PresupuestoPartida.prototype, "presupuestoId", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'concepto_id', type: 'uuid' }),
|
|
__metadata("design:type", String)
|
|
], PresupuestoPartida.prototype, "conceptoId", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ type: 'integer', default: 0 }),
|
|
__metadata("design:type", Number)
|
|
], PresupuestoPartida.prototype, "sequence", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ type: 'decimal', precision: 12, scale: 4, default: 0 }),
|
|
__metadata("design:type", Number)
|
|
], PresupuestoPartida.prototype, "quantity", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'unit_price', type: 'decimal', precision: 12, scale: 4, default: 0 }),
|
|
__metadata("design:type", Number)
|
|
], PresupuestoPartida.prototype, "unitPrice", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({
|
|
name: 'total_amount',
|
|
type: 'decimal',
|
|
precision: 14,
|
|
scale: 2,
|
|
insert: false,
|
|
update: false,
|
|
}),
|
|
__metadata("design:type", Number)
|
|
], PresupuestoPartida.prototype, "totalAmount", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }),
|
|
__metadata("design:type", Date)
|
|
], PresupuestoPartida.prototype, "createdAt", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'created_by', type: 'uuid', nullable: true }),
|
|
__metadata("design:type", Object)
|
|
], PresupuestoPartida.prototype, "createdById", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.UpdateDateColumn)({ name: 'updated_at', type: 'timestamptz', nullable: true }),
|
|
__metadata("design:type", Object)
|
|
], PresupuestoPartida.prototype, "updatedAt", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'updated_by', type: 'uuid', nullable: true }),
|
|
__metadata("design:type", Object)
|
|
], PresupuestoPartida.prototype, "updatedById", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'deleted_at', type: 'timestamptz', nullable: true }),
|
|
__metadata("design:type", Object)
|
|
], PresupuestoPartida.prototype, "deletedAt", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.Column)({ name: 'deleted_by', type: 'uuid', nullable: true }),
|
|
__metadata("design:type", Object)
|
|
], PresupuestoPartida.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)
|
|
], PresupuestoPartida.prototype, "tenant", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.ManyToOne)(() => presupuesto_entity_1.Presupuesto, (p) => p.partidas),
|
|
(0, typeorm_1.JoinColumn)({ name: 'presupuesto_id' }),
|
|
__metadata("design:type", presupuesto_entity_1.Presupuesto)
|
|
], PresupuestoPartida.prototype, "presupuesto", 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)
|
|
], PresupuestoPartida.prototype, "concepto", void 0);
|
|
__decorate([
|
|
(0, typeorm_1.ManyToOne)(() => user_entity_1.User),
|
|
(0, typeorm_1.JoinColumn)({ name: 'created_by' }),
|
|
__metadata("design:type", Object)
|
|
], PresupuestoPartida.prototype, "createdBy", void 0);
|
|
exports.PresupuestoPartida = PresupuestoPartida = __decorate([
|
|
(0, typeorm_1.Entity)({ schema: 'construction', name: 'presupuesto_partidas' }),
|
|
(0, typeorm_1.Index)(['presupuestoId', 'conceptoId'], { unique: true }),
|
|
(0, typeorm_1.Index)(['tenantId'])
|
|
], PresupuestoPartida);
|
|
//# sourceMappingURL=presupuesto-partida.entity.js.map
|