"use strict"; /** * RequisicionLinea Entity * Líneas de requisición de obra * * @module Inventory * @table inventory.requisicion_lineas * @ddl schemas/06-inventory-ext-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.RequisicionLinea = 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 requisicion_obra_entity_1 = require("./requisicion-obra.entity"); const concepto_entity_1 = require("../../budgets/entities/concepto.entity"); const lote_entity_1 = require("../../construction/entities/lote.entity"); let RequisicionLinea = class RequisicionLinea { id; tenantId; requisicionId; productId; conceptoId; loteId; quantityRequested; quantityApproved; quantityServed; unitId; notes; createdAt; createdById; updatedAt; updatedById; deletedAt; deletedById; // Relations tenant; requisicion; concepto; lote; createdBy; }; exports.RequisicionLinea = RequisicionLinea; __decorate([ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'), __metadata("design:type", String) ], RequisicionLinea.prototype, "id", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'tenant_id', type: 'uuid' }), __metadata("design:type", String) ], RequisicionLinea.prototype, "tenantId", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'requisicion_id', type: 'uuid' }), __metadata("design:type", String) ], RequisicionLinea.prototype, "requisicionId", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'product_id', type: 'uuid' }), __metadata("design:type", String) ], RequisicionLinea.prototype, "productId", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'concepto_id', type: 'uuid', nullable: true }), __metadata("design:type", String) ], RequisicionLinea.prototype, "conceptoId", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'lote_id', type: 'uuid', nullable: true }), __metadata("design:type", String) ], RequisicionLinea.prototype, "loteId", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'quantity_requested', type: 'decimal', precision: 12, scale: 4, }), __metadata("design:type", Number) ], RequisicionLinea.prototype, "quantityRequested", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'quantity_approved', type: 'decimal', precision: 12, scale: 4, nullable: true, }), __metadata("design:type", Number) ], RequisicionLinea.prototype, "quantityApproved", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'quantity_served', type: 'decimal', precision: 12, scale: 4, default: 0, }), __metadata("design:type", Number) ], RequisicionLinea.prototype, "quantityServed", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'unit_id', type: 'uuid', nullable: true }), __metadata("design:type", String) ], RequisicionLinea.prototype, "unitId", void 0); __decorate([ (0, typeorm_1.Column)({ type: 'text', nullable: true }), __metadata("design:type", String) ], RequisicionLinea.prototype, "notes", void 0); __decorate([ (0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz' }), __metadata("design:type", Date) ], RequisicionLinea.prototype, "createdAt", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'created_by', type: 'uuid', nullable: true }), __metadata("design:type", String) ], RequisicionLinea.prototype, "createdById", void 0); __decorate([ (0, typeorm_1.UpdateDateColumn)({ name: 'updated_at', type: 'timestamptz' }), __metadata("design:type", Date) ], RequisicionLinea.prototype, "updatedAt", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'updated_by', type: 'uuid', nullable: true }), __metadata("design:type", String) ], RequisicionLinea.prototype, "updatedById", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'deleted_at', type: 'timestamptz', nullable: true }), __metadata("design:type", Date) ], RequisicionLinea.prototype, "deletedAt", void 0); __decorate([ (0, typeorm_1.Column)({ name: 'deleted_by', type: 'uuid', nullable: true }), __metadata("design:type", String) ], RequisicionLinea.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) ], RequisicionLinea.prototype, "tenant", void 0); __decorate([ (0, typeorm_1.ManyToOne)(() => requisicion_obra_entity_1.RequisicionObra, (req) => req.lineas, { onDelete: 'CASCADE' }), (0, typeorm_1.JoinColumn)({ name: 'requisicion_id' }), __metadata("design:type", requisicion_obra_entity_1.RequisicionObra) ], RequisicionLinea.prototype, "requisicion", 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) ], RequisicionLinea.prototype, "concepto", void 0); __decorate([ (0, typeorm_1.ManyToOne)(() => lote_entity_1.Lote), (0, typeorm_1.JoinColumn)({ name: 'lote_id' }), __metadata("design:type", lote_entity_1.Lote) ], RequisicionLinea.prototype, "lote", void 0); __decorate([ (0, typeorm_1.ManyToOne)(() => user_entity_1.User), (0, typeorm_1.JoinColumn)({ name: 'created_by' }), __metadata("design:type", user_entity_1.User) ], RequisicionLinea.prototype, "createdBy", void 0); exports.RequisicionLinea = RequisicionLinea = __decorate([ (0, typeorm_1.Entity)({ schema: 'inventory', name: 'requisicion_lineas' }) ], RequisicionLinea); //# sourceMappingURL=requisicion-linea.entity.js.map