michangarrito/apps/backend/dist/modules/customers/entities/customer.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

105 lines
4.6 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.Customer = void 0;
const typeorm_1 = require("typeorm");
const fiado_entity_1 = require("./fiado.entity");
let Customer = class Customer {
};
exports.Customer = Customer;
__decorate([
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
__metadata("design:type", String)
], Customer.prototype, "id", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'tenant_id' }),
__metadata("design:type", String)
], Customer.prototype, "tenantId", void 0);
__decorate([
(0, typeorm_1.Column)({ length: 100 }),
__metadata("design:type", String)
], Customer.prototype, "name", void 0);
__decorate([
(0, typeorm_1.Column)({ length: 20, nullable: true }),
__metadata("design:type", String)
], Customer.prototype, "phone", void 0);
__decorate([
(0, typeorm_1.Column)({ length: 100, nullable: true }),
__metadata("design:type", String)
], Customer.prototype, "email", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
__metadata("design:type", String)
], Customer.prototype, "address", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'address_reference', type: 'text', nullable: true }),
__metadata("design:type", String)
], Customer.prototype, "addressReference", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'decimal', precision: 10, scale: 8, nullable: true }),
__metadata("design:type", Number)
], Customer.prototype, "latitude", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'decimal', precision: 11, scale: 8, nullable: true }),
__metadata("design:type", Number)
], Customer.prototype, "longitude", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'fiado_enabled', default: true }),
__metadata("design:type", Boolean)
], Customer.prototype, "fiadoEnabled", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'fiado_limit', type: 'decimal', precision: 10, scale: 2, nullable: true }),
__metadata("design:type", Number)
], Customer.prototype, "fiadoLimit", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'current_fiado_balance', type: 'decimal', precision: 10, scale: 2, default: 0 }),
__metadata("design:type", Number)
], Customer.prototype, "currentFiadoBalance", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'total_purchases', type: 'decimal', precision: 12, scale: 2, default: 0 }),
__metadata("design:type", Number)
], Customer.prototype, "totalPurchases", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'purchase_count', default: 0 }),
__metadata("design:type", Number)
], Customer.prototype, "purchaseCount", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'last_purchase_at', type: 'timestamptz', nullable: true }),
__metadata("design:type", Date)
], Customer.prototype, "lastPurchaseAt", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'whatsapp_opt_in', default: false }),
__metadata("design:type", Boolean)
], Customer.prototype, "whatsappOptIn", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
__metadata("design:type", String)
], Customer.prototype, "notes", void 0);
__decorate([
(0, typeorm_1.Column)({ length: 20, default: 'active' }),
__metadata("design:type", String)
], Customer.prototype, "status", void 0);
__decorate([
(0, typeorm_1.CreateDateColumn)({ name: 'created_at' }),
__metadata("design:type", Date)
], Customer.prototype, "createdAt", void 0);
__decorate([
(0, typeorm_1.UpdateDateColumn)({ name: 'updated_at' }),
__metadata("design:type", Date)
], Customer.prototype, "updatedAt", void 0);
__decorate([
(0, typeorm_1.OneToMany)(() => fiado_entity_1.Fiado, (fiado) => fiado.customer),
__metadata("design:type", Array)
], Customer.prototype, "fiados", void 0);
exports.Customer = Customer = __decorate([
(0, typeorm_1.Entity)({ schema: 'customers', name: 'customers' })
], Customer);
//# sourceMappingURL=customer.entity.js.map