"use strict"; /** * AvanceObra Entity * Registro de avances fisicos de obra por lote/departamento * * @module Progress * @table construction.avances_obra * @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.AvanceObra = 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 foto_avance_entity_1 = require("./foto-avance.entity"); let AvanceObra = class AvanceObra { id; tenantId; loteId; departamentoId; conceptoId; captureDate; quantityExecuted; percentageExecuted; status; notes; capturedById; reviewedById; reviewedAt; approvedById; approvedAt; createdAt; createdById; updatedAt; updatedById; deletedAt; deletedById; // Relations tenant; concepto; capturedBy; reviewedBy; approvedBy; fotos; }; exports.AvanceObra = AvanceObra; __decorate([ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'), __metadata("design:type", String) ], AvanceObra.prototype, "id", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'tenant_id', type: 'uuid' }), __metadata("design:type", String) ], AvanceObra.prototype, "tenantId", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'lote_id', type: 'uuid', nullable: true }), __metadata("design:type", Object) ], AvanceObra.prototype, "loteId", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'departamento_id', type: 'uuid', nullable: true }), __metadata("design:type", Object) ], AvanceObra.prototype, "departamentoId", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'concepto_id', type: 'uuid' }), __metadata("design:type", String) ], AvanceObra.prototype, "conceptoId", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'capture_date', type: 'date' }), __metadata("design:type", Date) ], AvanceObra.prototype, "captureDate", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'quantity_executed', type: 'decimal', precision: 12, scale: 4, default: 0 }), __metadata("design:type", Number) ], AvanceObra.prototype, "quantityExecuted", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'percentage_executed', type: 'decimal', precision: 5, scale: 2, default: 0 }), __metadata("design:type", Number) ], AvanceObra.prototype, "percentageExecuted", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'enum', enum: ['pending', 'captured', 'reviewed', 'approved', 'rejected'], enumName: 'construction.advance_status', default: 'pending', }), __metadata("design:type", String) ], AvanceObra.prototype, "status", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'text', nullable: true }), __metadata("design:type", Object) ], AvanceObra.prototype, "notes", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'captured_by', type: 'uuid' }), __metadata("design:type", String) ], AvanceObra.prototype, "capturedById", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'reviewed_by', type: 'uuid', nullable: true }), __metadata("design:type", Object) ], AvanceObra.prototype, "reviewedById", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'reviewed_at', type: 'timestamptz', nullable: true }), __metadata("design:type", Object) ], AvanceObra.prototype, "reviewedAt", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'approved_by', type: 'uuid', nullable: true }), __metadata("design:type", Object) ], AvanceObra.prototype, "approvedById", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'approved_at', type: 'timestamptz', nullable: true }), __metadata("design:type", Object) ], AvanceObra.prototype, "approvedAt", void 0); __decorate([ (0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }), __metadata("design:type", Date) ], AvanceObra.prototype, "createdAt", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'created_by', type: 'uuid', nullable: true }), __metadata("design:type", Object) ], AvanceObra.prototype, "createdById", void 0); __decorate([ (0, typeorm_1.UpdateDateColumn)({ name: 'updated_at', type: 'timestamptz', nullable: true }), __metadata("design:type", Object) ], AvanceObra.prototype, "updatedAt", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'updated_by', type: 'uuid', nullable: true }), __metadata("design:type", Object) ], AvanceObra.prototype, "updatedById", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'deleted_at', type: 'timestamptz', nullable: true }), __metadata("design:type", Object) ], AvanceObra.prototype, "deletedAt", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'deleted_by', type: 'uuid', nullable: true }), __metadata("design:type", Object) ], AvanceObra.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) ], AvanceObra.prototype, "tenant", 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) ], AvanceObra.prototype, "concepto", void 0); __decorate([ (0, typeorm_1.ManyToOne)(() => user_entity_1.User), (0, typeorm_1.JoinColumn)({ name: 'captured_by' }), __metadata("design:type", user_entity_1.User) ], AvanceObra.prototype, "capturedBy", void 0); __decorate([ (0, typeorm_1.ManyToOne)(() => user_entity_1.User), (0, typeorm_1.JoinColumn)({ name: 'reviewed_by' }), __metadata("design:type", Object) ], AvanceObra.prototype, "reviewedBy", void 0); __decorate([ (0, typeorm_1.ManyToOne)(() => user_entity_1.User), (0, typeorm_1.JoinColumn)({ name: 'approved_by' }), __metadata("design:type", Object) ], AvanceObra.prototype, "approvedBy", void 0); __decorate([ (0, typeorm_1.OneToMany)(() => foto_avance_entity_1.FotoAvance, (f) => f.avance), __metadata("design:type", Array) ], AvanceObra.prototype, "fotos", void 0); exports.AvanceObra = AvanceObra = __decorate([ (0, typeorm_1.Entity)({ schema: 'construction', name: 'avances_obra' }), (0, typeorm_1.Index)(['tenantId']), (0, typeorm_1.Index)(['loteId']), (0, typeorm_1.Index)(['conceptoId']), (0, typeorm_1.Index)(['captureDate']), (0, typeorm_1.Check)(`"lote_id" IS NOT NULL AND "departamento_id" IS NULL OR "lote_id" IS NULL AND "departamento_id" IS NOT NULL`) ], AvanceObra); //# sourceMappingURL=avance-obra.entity.js.map