erp-construccion-backend/dist/modules/construction/entities/manzana.entity.js

96 lines
3.7 KiB
JavaScript

"use strict";
/**
* Manzana Entity
* Manzanas (bloques) dentro de una etapa
*
* @module Construction
*/
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.Manzana = void 0;
const typeorm_1 = require("typeorm");
const etapa_entity_1 = require("./etapa.entity");
const lote_entity_1 = require("./lote.entity");
let Manzana = class Manzana {
id;
tenantId;
etapaId;
code;
name;
totalLots;
createdAt;
createdBy;
updatedAt;
updatedBy;
deletedAt;
// Relations
etapa;
lotes;
};
exports.Manzana = Manzana;
__decorate([
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
__metadata("design:type", String)
], Manzana.prototype, "id", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'tenant_id', type: 'uuid' }),
__metadata("design:type", String)
], Manzana.prototype, "tenantId", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'etapa_id', type: 'uuid' }),
__metadata("design:type", String)
], Manzana.prototype, "etapaId", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', length: 20 }),
__metadata("design:type", String)
], Manzana.prototype, "code", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', length: 100, nullable: true }),
__metadata("design:type", String)
], Manzana.prototype, "name", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'total_lots', type: 'integer', default: 0 }),
__metadata("design:type", Number)
], Manzana.prototype, "totalLots", void 0);
__decorate([
(0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }),
__metadata("design:type", Date)
], Manzana.prototype, "createdAt", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'created_by', type: 'uuid', nullable: true }),
__metadata("design:type", String)
], Manzana.prototype, "createdBy", void 0);
__decorate([
(0, typeorm_1.UpdateDateColumn)({ name: 'updated_at', type: 'timestamptz', nullable: true }),
__metadata("design:type", Date)
], Manzana.prototype, "updatedAt", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'updated_by', type: 'uuid', nullable: true }),
__metadata("design:type", String)
], Manzana.prototype, "updatedBy", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'deleted_at', type: 'timestamptz', nullable: true }),
__metadata("design:type", Date)
], Manzana.prototype, "deletedAt", void 0);
__decorate([
(0, typeorm_1.ManyToOne)(() => etapa_entity_1.Etapa, (e) => e.manzanas, { onDelete: 'CASCADE' }),
(0, typeorm_1.JoinColumn)({ name: 'etapa_id' }),
__metadata("design:type", etapa_entity_1.Etapa)
], Manzana.prototype, "etapa", void 0);
__decorate([
(0, typeorm_1.OneToMany)(() => lote_entity_1.Lote, (l) => l.manzana),
__metadata("design:type", Array)
], Manzana.prototype, "lotes", void 0);
exports.Manzana = Manzana = __decorate([
(0, typeorm_1.Entity)({ schema: 'construction', name: 'manzanas' }),
(0, typeorm_1.Index)(['etapaId', 'code'], { unique: true })
], Manzana);
//# sourceMappingURL=manzana.entity.js.map