erp-construccion/backend/dist/modules/budgets/entities/presupuesto.entity.js

160 lines
6.5 KiB
JavaScript

"use strict";
/**
* Presupuesto Entity
* Presupuestos de obra por prototipo o fraccionamiento
*
* @module Budgets
* @table construction.presupuestos
* @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.Presupuesto = 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 presupuesto_partida_entity_1 = require("./presupuesto-partida.entity");
let Presupuesto = class Presupuesto {
id;
tenantId;
fraccionamientoId;
prototipoId;
code;
name;
description;
version;
isActive;
totalAmount;
currencyId;
approvedAt;
approvedById;
createdAt;
createdById;
updatedAt;
updatedById;
deletedAt;
deletedById;
// Relations
tenant;
fraccionamiento;
createdBy;
approvedBy;
partidas;
};
exports.Presupuesto = Presupuesto;
__decorate([
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
__metadata("design:type", String)
], Presupuesto.prototype, "id", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'tenant_id', type: 'uuid' }),
__metadata("design:type", String)
], Presupuesto.prototype, "tenantId", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'fraccionamiento_id', type: 'uuid', nullable: true }),
__metadata("design:type", Object)
], Presupuesto.prototype, "fraccionamientoId", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'prototipo_id', type: 'uuid', nullable: true }),
__metadata("design:type", Object)
], Presupuesto.prototype, "prototipoId", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', length: 30 }),
__metadata("design:type", String)
], Presupuesto.prototype, "code", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', length: 255 }),
__metadata("design:type", String)
], Presupuesto.prototype, "name", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
__metadata("design:type", Object)
], Presupuesto.prototype, "description", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'integer', default: 1 }),
__metadata("design:type", Number)
], Presupuesto.prototype, "version", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'is_active', type: 'boolean', default: true }),
__metadata("design:type", Boolean)
], Presupuesto.prototype, "isActive", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'total_amount', type: 'decimal', precision: 16, scale: 2, default: 0 }),
__metadata("design:type", Number)
], Presupuesto.prototype, "totalAmount", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'currency_id', type: 'uuid', nullable: true }),
__metadata("design:type", Object)
], Presupuesto.prototype, "currencyId", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'approved_at', type: 'timestamptz', nullable: true }),
__metadata("design:type", Object)
], Presupuesto.prototype, "approvedAt", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'approved_by', type: 'uuid', nullable: true }),
__metadata("design:type", Object)
], Presupuesto.prototype, "approvedById", void 0);
__decorate([
(0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }),
__metadata("design:type", Date)
], Presupuesto.prototype, "createdAt", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'created_by', type: 'uuid', nullable: true }),
__metadata("design:type", Object)
], Presupuesto.prototype, "createdById", void 0);
__decorate([
(0, typeorm_1.UpdateDateColumn)({ name: 'updated_at', type: 'timestamptz', nullable: true }),
__metadata("design:type", Object)
], Presupuesto.prototype, "updatedAt", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'updated_by', type: 'uuid', nullable: true }),
__metadata("design:type", Object)
], Presupuesto.prototype, "updatedById", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'deleted_at', type: 'timestamptz', nullable: true }),
__metadata("design:type", Object)
], Presupuesto.prototype, "deletedAt", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'deleted_by', type: 'uuid', nullable: true }),
__metadata("design:type", Object)
], Presupuesto.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)
], Presupuesto.prototype, "tenant", void 0);
__decorate([
(0, typeorm_1.ManyToOne)(() => fraccionamiento_entity_1.Fraccionamiento, { nullable: true }),
(0, typeorm_1.JoinColumn)({ name: 'fraccionamiento_id' }),
__metadata("design:type", Object)
], Presupuesto.prototype, "fraccionamiento", void 0);
__decorate([
(0, typeorm_1.ManyToOne)(() => user_entity_1.User),
(0, typeorm_1.JoinColumn)({ name: 'created_by' }),
__metadata("design:type", Object)
], Presupuesto.prototype, "createdBy", void 0);
__decorate([
(0, typeorm_1.ManyToOne)(() => user_entity_1.User),
(0, typeorm_1.JoinColumn)({ name: 'approved_by' }),
__metadata("design:type", Object)
], Presupuesto.prototype, "approvedBy", void 0);
__decorate([
(0, typeorm_1.OneToMany)(() => presupuesto_partida_entity_1.PresupuestoPartida, (p) => p.presupuesto),
__metadata("design:type", Array)
], Presupuesto.prototype, "partidas", void 0);
exports.Presupuesto = Presupuesto = __decorate([
(0, typeorm_1.Entity)({ schema: 'construction', name: 'presupuestos' }),
(0, typeorm_1.Index)(['tenantId', 'code', 'version'], { unique: true }),
(0, typeorm_1.Index)(['tenantId']),
(0, typeorm_1.Index)(['fraccionamientoId'])
], Presupuesto);
//# sourceMappingURL=presupuesto.entity.js.map