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

149 lines
5.7 KiB
JavaScript

"use strict";
/**
* Concepto Entity
* Catalogo de conceptos de obra (estructura jerarquica)
*
* @module Budgets
* @table construction.conceptos
* @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.Concepto = 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");
let Concepto = class Concepto {
id;
tenantId;
parentId;
code;
name;
description;
unitId;
unitPrice;
isComposite;
level;
path;
createdAt;
createdById;
updatedAt;
updatedById;
deletedAt;
deletedById;
// Relations
tenant;
parent;
children;
createdBy;
updatedBy;
};
exports.Concepto = Concepto;
__decorate([
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
__metadata("design:type", String)
], Concepto.prototype, "id", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'tenant_id', type: 'uuid' }),
__metadata("design:type", String)
], Concepto.prototype, "tenantId", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'parent_id', type: 'uuid', nullable: true }),
__metadata("design:type", Object)
], Concepto.prototype, "parentId", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', length: 50 }),
__metadata("design:type", String)
], Concepto.prototype, "code", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', length: 255 }),
__metadata("design:type", String)
], Concepto.prototype, "name", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
__metadata("design:type", Object)
], Concepto.prototype, "description", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'unit_id', type: 'uuid', nullable: true }),
__metadata("design:type", Object)
], Concepto.prototype, "unitId", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'unit_price', type: 'decimal', precision: 12, scale: 4, nullable: true }),
__metadata("design:type", Object)
], Concepto.prototype, "unitPrice", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'is_composite', type: 'boolean', default: false }),
__metadata("design:type", Boolean)
], Concepto.prototype, "isComposite", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'integer', default: 0 }),
__metadata("design:type", Number)
], Concepto.prototype, "level", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', length: 500, nullable: true }),
__metadata("design:type", Object)
], Concepto.prototype, "path", void 0);
__decorate([
(0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }),
__metadata("design:type", Date)
], Concepto.prototype, "createdAt", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'created_by', type: 'uuid', nullable: true }),
__metadata("design:type", Object)
], Concepto.prototype, "createdById", void 0);
__decorate([
(0, typeorm_1.UpdateDateColumn)({ name: 'updated_at', type: 'timestamptz', nullable: true }),
__metadata("design:type", Object)
], Concepto.prototype, "updatedAt", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'updated_by', type: 'uuid', nullable: true }),
__metadata("design:type", Object)
], Concepto.prototype, "updatedById", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'deleted_at', type: 'timestamptz', nullable: true }),
__metadata("design:type", Object)
], Concepto.prototype, "deletedAt", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'deleted_by', type: 'uuid', nullable: true }),
__metadata("design:type", Object)
], Concepto.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)
], Concepto.prototype, "tenant", void 0);
__decorate([
(0, typeorm_1.ManyToOne)(() => Concepto, (c) => c.children, { nullable: true }),
(0, typeorm_1.JoinColumn)({ name: 'parent_id' }),
__metadata("design:type", Object)
], Concepto.prototype, "parent", void 0);
__decorate([
(0, typeorm_1.OneToMany)(() => Concepto, (c) => c.parent),
__metadata("design:type", Array)
], Concepto.prototype, "children", void 0);
__decorate([
(0, typeorm_1.ManyToOne)(() => user_entity_1.User),
(0, typeorm_1.JoinColumn)({ name: 'created_by' }),
__metadata("design:type", Object)
], Concepto.prototype, "createdBy", void 0);
__decorate([
(0, typeorm_1.ManyToOne)(() => user_entity_1.User),
(0, typeorm_1.JoinColumn)({ name: 'updated_by' }),
__metadata("design:type", Object)
], Concepto.prototype, "updatedBy", void 0);
exports.Concepto = Concepto = __decorate([
(0, typeorm_1.Entity)({ schema: 'construction', name: 'conceptos' }),
(0, typeorm_1.Index)(['tenantId', 'code'], { unique: true }),
(0, typeorm_1.Index)(['tenantId']),
(0, typeorm_1.Index)(['parentId']),
(0, typeorm_1.Index)(['code'])
], Concepto);
//# sourceMappingURL=concepto.entity.js.map