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

166 lines
7.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.Supplier = exports.SupplierStatus = void 0;
const typeorm_1 = require("typeorm");
const supplier_product_entity_1 = require("./supplier-product.entity");
const supplier_order_entity_1 = require("./supplier-order.entity");
const supplier_review_entity_1 = require("./supplier-review.entity");
var SupplierStatus;
(function (SupplierStatus) {
SupplierStatus["PENDING"] = "pending";
SupplierStatus["ACTIVE"] = "active";
SupplierStatus["SUSPENDED"] = "suspended";
SupplierStatus["INACTIVE"] = "inactive";
})(SupplierStatus || (exports.SupplierStatus = SupplierStatus = {}));
let Supplier = class Supplier {
};
exports.Supplier = Supplier;
__decorate([
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
__metadata("design:type", String)
], Supplier.prototype, "id", void 0);
__decorate([
(0, typeorm_1.Column)({ length: 200 }),
__metadata("design:type", String)
], Supplier.prototype, "name", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'legal_name', length: 300, nullable: true }),
__metadata("design:type", String)
], Supplier.prototype, "legalName", void 0);
__decorate([
(0, typeorm_1.Column)({ length: 13, nullable: true }),
__metadata("design:type", String)
], Supplier.prototype, "rfc", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'text', array: true, default: '{}' }),
__metadata("design:type", Array)
], Supplier.prototype, "categories", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'coverage_zones', type: 'text', array: true, default: '{}' }),
__metadata("design:type", Array)
], Supplier.prototype, "coverageZones", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'contact_name', length: 200, nullable: true }),
__metadata("design:type", String)
], Supplier.prototype, "contactName", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'contact_phone', length: 20, nullable: true }),
__metadata("design:type", String)
], Supplier.prototype, "contactPhone", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'contact_email', length: 200, nullable: true }),
__metadata("design:type", String)
], Supplier.prototype, "contactEmail", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'contact_whatsapp', length: 20, nullable: true }),
__metadata("design:type", String)
], Supplier.prototype, "contactWhatsapp", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
__metadata("design:type", String)
], Supplier.prototype, "address", void 0);
__decorate([
(0, typeorm_1.Column)({ length: 100, nullable: true }),
__metadata("design:type", String)
], Supplier.prototype, "city", void 0);
__decorate([
(0, typeorm_1.Column)({ length: 100, nullable: true }),
__metadata("design:type", String)
], Supplier.prototype, "state", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'zip_code', length: 10, nullable: true }),
__metadata("design:type", String)
], Supplier.prototype, "zipCode", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'logo_url', type: 'text', nullable: true }),
__metadata("design:type", String)
], Supplier.prototype, "logoUrl", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'banner_url', type: 'text', nullable: true }),
__metadata("design:type", String)
], Supplier.prototype, "bannerUrl", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
__metadata("design:type", String)
], Supplier.prototype, "description", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'min_order_amount', type: 'decimal', precision: 10, scale: 2, default: 0 }),
__metadata("design:type", Number)
], Supplier.prototype, "minOrderAmount", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'delivery_fee', type: 'decimal', precision: 10, scale: 2, default: 0 }),
__metadata("design:type", Number)
], Supplier.prototype, "deliveryFee", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'free_delivery_min', type: 'decimal', precision: 10, scale: 2, nullable: true }),
__metadata("design:type", Number)
], Supplier.prototype, "freeDeliveryMin", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'delivery_days', type: 'text', array: true, default: '{}' }),
__metadata("design:type", Array)
], Supplier.prototype, "deliveryDays", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'lead_time_days', default: 1 }),
__metadata("design:type", Number)
], Supplier.prototype, "leadTimeDays", void 0);
__decorate([
(0, typeorm_1.Column)({ default: false }),
__metadata("design:type", Boolean)
], Supplier.prototype, "verified", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'verified_at', type: 'timestamptz', nullable: true }),
__metadata("design:type", Date)
], Supplier.prototype, "verifiedAt", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'decimal', precision: 2, scale: 1, default: 0 }),
__metadata("design:type", Number)
], Supplier.prototype, "rating", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'total_reviews', default: 0 }),
__metadata("design:type", Number)
], Supplier.prototype, "totalReviews", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'total_orders', default: 0 }),
__metadata("design:type", Number)
], Supplier.prototype, "totalOrders", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'varchar', length: 20, default: SupplierStatus.PENDING }),
__metadata("design:type", String)
], Supplier.prototype, "status", void 0);
__decorate([
(0, typeorm_1.Column)({ name: 'user_id', nullable: true }),
__metadata("design:type", String)
], Supplier.prototype, "userId", void 0);
__decorate([
(0, typeorm_1.CreateDateColumn)({ name: 'created_at' }),
__metadata("design:type", Date)
], Supplier.prototype, "createdAt", void 0);
__decorate([
(0, typeorm_1.UpdateDateColumn)({ name: 'updated_at' }),
__metadata("design:type", Date)
], Supplier.prototype, "updatedAt", void 0);
__decorate([
(0, typeorm_1.OneToMany)(() => supplier_product_entity_1.SupplierProduct, (product) => product.supplier),
__metadata("design:type", Array)
], Supplier.prototype, "products", void 0);
__decorate([
(0, typeorm_1.OneToMany)(() => supplier_order_entity_1.SupplierOrder, (order) => order.supplier),
__metadata("design:type", Array)
], Supplier.prototype, "orders", void 0);
__decorate([
(0, typeorm_1.OneToMany)(() => supplier_review_entity_1.SupplierReview, (review) => review.supplier),
__metadata("design:type", Array)
], Supplier.prototype, "reviews", void 0);
exports.Supplier = Supplier = __decorate([
(0, typeorm_1.Entity)({ schema: 'marketplace', name: 'suppliers' })
], Supplier);
//# sourceMappingURL=supplier.entity.js.map