michangarrito/apps/backend/dist/modules/sales/entities/sale-item.entity.js
rckrdmrd 97f407c661 [MIGRATION-V2] feat: Migrar michangarrito a estructura v2
- Prefijo v2: MCH
- TRACEABILITY-MASTER.yml creado
- Listo para integracion como submodulo

Workspace: v2.0.0 | SIMCO: v4.0.0
2026-01-10 11:28:54 -06:00

72 lines
3.4 KiB
JavaScript

"use strict";
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.SaleItem = void 0;
const typeorm_1 = require("typeorm");
const sale_entity_1 = require("./sale.entity");
const product_entity_1 = require("../../products/entities/product.entity");
let SaleItem = class SaleItem {
};
exports.SaleItem = SaleItem;
__decorate([
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
__metadata("design:type", String)
], SaleItem.prototype, "id", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'sale_id' }),
__metadata("design:type", String)
], SaleItem.prototype, "saleId", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'product_id', nullable: true }),
__metadata("design:type", String)
], SaleItem.prototype, "productId", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'product_name', length: 200 }),
__metadata("design:type", String)
], SaleItem.prototype, "productName", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'product_sku', length: 50, nullable: true }),
__metadata("design:type", String)
], SaleItem.prototype, "productSku", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'decimal', precision: 12, scale: 3 }),
__metadata("design:type", Number)
], SaleItem.prototype, "quantity", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'unit_price', type: 'decimal', precision: 12, scale: 2 }),
__metadata("design:type", Number)
], SaleItem.prototype, "unitPrice", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'discount_percent', type: 'decimal', precision: 5, scale: 2, default: 0 }),
__metadata("design:type", Number)
], SaleItem.prototype, "discountPercent", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'decimal', precision: 12, scale: 2 }),
__metadata("design:type", Number)
], SaleItem.prototype, "subtotal", void 0);
__decorate([
(0, typeorm_1.CreateDateColumn)({ name: 'created_at' }),
__metadata("design:type", Date)
], SaleItem.prototype, "createdAt", void 0);
__decorate([
(0, typeorm_1.ManyToOne)(() => sale_entity_1.Sale, (sale) => sale.items, { onDelete: 'CASCADE' }),
(0, typeorm_1.JoinColumn)({ name: 'sale_id' }),
__metadata("design:type", sale_entity_1.Sale)
], SaleItem.prototype, "sale", void 0);
__decorate([
(0, typeorm_1.ManyToOne)(() => product_entity_1.Product, { nullable: true }),
(0, typeorm_1.JoinColumn)({ name: 'product_id' }),
__metadata("design:type", product_entity_1.Product)
], SaleItem.prototype, "product", void 0);
exports.SaleItem = SaleItem = __decorate([
(0, typeorm_1.Entity)({ schema: 'sales', name: 'sale_items' })
], SaleItem);
//# sourceMappingURL=sale-item.entity.js.map