[MCH-DOC-VAL] docs: Validar documentacion vs codigo - corregir discrepancias
Validacion completa de documentacion tecnica contra codigo real: - ENTITIES-CATALOG.md: 35+ -> 38 entities (validado) - SERVICES-CATALOG.md: 30+ -> 18 services (validado) - MODULES-CATALOG.md: 24 -> 17 modulos (validado) - DATABASE-SCHEMA.md: Corregido - TypeORM genera tablas, no hay SQL separado - _INDEX.yml: Metricas actualizadas y marcadas como validadas - MASTER_INVENTORY.yml: Sincronizado con conteos reales Discrepancias corregidas: - La doc anterior incluia objetos planificados como implementados - Schemas 15 -> 1 (public, TypeORM) - Tablas ~65 -> 38 (1:1 con entities) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
430e5d85b5
commit
5552e64ce6
@ -4,13 +4,15 @@ type: Definition
|
||||
title: "Database Schema"
|
||||
simco_version: "4.0.1"
|
||||
updated_at: 2026-01-17
|
||||
validated: true
|
||||
---
|
||||
|
||||
# Database Schema - MiChangarrito
|
||||
|
||||
**Alias:** @MCH_DEF_DB
|
||||
**Version:** 1.0.0
|
||||
**Version:** 2.0.0
|
||||
**Ultima actualizacion:** 2026-01-17
|
||||
**Estado:** VALIDADO vs Codigo
|
||||
|
||||
---
|
||||
|
||||
@ -18,368 +20,205 @@ updated_at: 2026-01-17
|
||||
|
||||
| Metrica | Valor |
|
||||
|---------|-------|
|
||||
| **Total Schemas** | 15 |
|
||||
| **Total Tablas** | ~65 |
|
||||
| **Total Funciones** | 20 |
|
||||
| **Total Triggers** | 25+ |
|
||||
| **Extensiones** | 5 |
|
||||
| **ORM** | TypeORM 0.3.19 |
|
||||
| **DB Engine** | PostgreSQL 16+ |
|
||||
| **Schema** | public (unico) |
|
||||
| **Total Tablas** | 38 (generadas por entities) |
|
||||
| **Multi-tenant** | Si (tenant_id en todas las tablas) |
|
||||
|
||||
**Nota:** Este proyecto utiliza TypeORM con migraciones automaticas. Las tablas se generan a partir de las entities definidas en `backend/src/modules/*/entities/`.
|
||||
|
||||
---
|
||||
|
||||
## 2. SCHEMAS
|
||||
## 2. TABLAS POR MODULO
|
||||
|
||||
### 2.1 Schema: public
|
||||
### 2.1 Auth (2 tablas)
|
||||
|
||||
```yaml
|
||||
descripcion: "Schema principal - Usuarios y configuracion base"
|
||||
tablas:
|
||||
- users
|
||||
- roles
|
||||
- permissions
|
||||
- user_roles
|
||||
```
|
||||
| Tabla | Entity | Descripcion |
|
||||
|-------|--------|-------------|
|
||||
| tenants | Tenant | Tiendas/Changarritos (multi-tenant root) |
|
||||
| users | User | Usuarios del sistema |
|
||||
|
||||
### 2.2 Schema: stores
|
||||
### 2.2 Categories (1 tabla)
|
||||
|
||||
```yaml
|
||||
descripcion: "Gestion de tiendas/changarritos"
|
||||
tablas:
|
||||
- stores
|
||||
- store_settings
|
||||
- store_hours
|
||||
```
|
||||
| Tabla | Entity | Descripcion |
|
||||
|-------|--------|-------------|
|
||||
| categories | Category | Categorias de productos |
|
||||
|
||||
### 2.3 Schema: products
|
||||
### 2.3 CoDi-SPEI (3 tablas)
|
||||
|
||||
```yaml
|
||||
descripcion: "Catalogo de productos e inventario"
|
||||
tablas:
|
||||
- products
|
||||
- categories
|
||||
- inventory
|
||||
- price_history
|
||||
```
|
||||
| Tabla | Entity | Descripcion |
|
||||
|-------|--------|-------------|
|
||||
| codi_transactions | CodiTransaction | Transacciones CoDi |
|
||||
| spei_transactions | SpeiTransaction | Transacciones SPEI |
|
||||
| virtual_accounts | VirtualAccount | Cuentas virtuales |
|
||||
|
||||
### 2.4 Schema: sales
|
||||
### 2.4 Customers (3 tablas)
|
||||
|
||||
```yaml
|
||||
descripcion: "Punto de venta y transacciones"
|
||||
tablas:
|
||||
- sales
|
||||
- sale_items
|
||||
- payments
|
||||
- cash_registers
|
||||
```
|
||||
| Tabla | Entity | Descripcion |
|
||||
|-------|--------|-------------|
|
||||
| customers | Customer | Clientes del changarrito |
|
||||
| fiados | Fiado | Creditos/fiados |
|
||||
| fiado_payments | FiadoPayment | Pagos de fiados |
|
||||
|
||||
### 2.5 Schema: orders
|
||||
### 2.5 Integrations (2 tablas)
|
||||
|
||||
```yaml
|
||||
descripcion: "Pedidos y entregas"
|
||||
tablas:
|
||||
- orders
|
||||
- order_items
|
||||
- deliveries
|
||||
```
|
||||
| Tabla | Entity | Descripcion |
|
||||
|-------|--------|-------------|
|
||||
| tenant_integration_credentials | TenantIntegrationCredential | Credenciales por tenant |
|
||||
| tenant_whatsapp_numbers | TenantWhatsappNumber | Numeros WhatsApp |
|
||||
|
||||
### 2.6 Schema: customers
|
||||
### 2.6 Inventory (2 tablas)
|
||||
|
||||
```yaml
|
||||
descripcion: "Gestion de clientes"
|
||||
tablas:
|
||||
- customers
|
||||
- customer_addresses
|
||||
```
|
||||
| Tabla | Entity | Descripcion |
|
||||
|-------|--------|-------------|
|
||||
| inventory_movements | InventoryMovement | Movimientos de stock |
|
||||
| stock_alerts | StockAlert | Alertas de stock bajo |
|
||||
|
||||
### 2.7 Schema: fiados
|
||||
### 2.7 Invoices (3 tablas)
|
||||
|
||||
```yaml
|
||||
descripcion: "Sistema de creditos/fiados"
|
||||
tablas:
|
||||
- fiados
|
||||
- fiado_payments
|
||||
- credit_limits
|
||||
```
|
||||
| Tabla | Entity | Descripcion |
|
||||
|-------|--------|-------------|
|
||||
| invoices | Invoice | Facturas CFDI |
|
||||
| invoice_items | InvoiceItem | Items de factura |
|
||||
| tax_configs | TaxConfig | Configuracion fiscal |
|
||||
|
||||
### 2.8 Schema: subscriptions
|
||||
### 2.8 Marketplace (6 tablas)
|
||||
|
||||
```yaml
|
||||
descripcion: "Planes y suscripciones SaaS"
|
||||
tablas:
|
||||
- plans
|
||||
- subscriptions
|
||||
- subscription_history
|
||||
```
|
||||
| Tabla | Entity | Descripcion |
|
||||
|-------|--------|-------------|
|
||||
| suppliers | Supplier | Proveedores B2B |
|
||||
| supplier_products | SupplierProduct | Productos de proveedores |
|
||||
| supplier_orders | SupplierOrder | Ordenes a proveedores |
|
||||
| supplier_order_items | SupplierOrderItem | Items de orden |
|
||||
| supplier_reviews | SupplierReview | Resenas |
|
||||
| supplier_favorites | SupplierFavorites | Favoritos |
|
||||
|
||||
### 2.9 Schema: tokens
|
||||
### 2.9 Messaging (3 tablas)
|
||||
|
||||
```yaml
|
||||
descripcion: "Tienda de tokens IA"
|
||||
tablas:
|
||||
- token_packages
|
||||
- token_purchases
|
||||
- token_usage
|
||||
```
|
||||
| Tabla | Entity | Descripcion |
|
||||
|-------|--------|-------------|
|
||||
| conversations | Conversation | Conversaciones |
|
||||
| messages | Message | Mensajes |
|
||||
| notifications | Notification | Notificaciones |
|
||||
|
||||
### 2.10 Schema: notifications
|
||||
### 2.10 Orders (2 tablas)
|
||||
|
||||
```yaml
|
||||
descripcion: "Sistema de notificaciones"
|
||||
tablas:
|
||||
- notifications
|
||||
- notification_templates
|
||||
- notification_logs
|
||||
```
|
||||
| Tabla | Entity | Descripcion |
|
||||
|-------|--------|-------------|
|
||||
| orders | Order | Pedidos |
|
||||
| order_items | OrderItem | Items del pedido |
|
||||
|
||||
### 2.11 Schema: integrations
|
||||
### 2.11 Payments (1 tabla)
|
||||
|
||||
```yaml
|
||||
descripcion: "Integraciones externas"
|
||||
tablas:
|
||||
- whatsapp_configs
|
||||
- llm_configs
|
||||
- payment_configs
|
||||
```
|
||||
| Tabla | Entity | Descripcion |
|
||||
|-------|--------|-------------|
|
||||
| payment_methods | PaymentMethod | Metodos de pago |
|
||||
|
||||
### 2.12 Schema: analytics
|
||||
### 2.12 Products (1 tabla)
|
||||
|
||||
```yaml
|
||||
descripcion: "Metricas y reportes"
|
||||
tablas:
|
||||
- daily_metrics
|
||||
- monthly_reports
|
||||
- predictions
|
||||
```
|
||||
| Tabla | Entity | Descripcion |
|
||||
|-------|--------|-------------|
|
||||
| products | Product | Productos del catalogo |
|
||||
|
||||
### 2.13 Schema: ai
|
||||
### 2.13 Referrals (3 tablas)
|
||||
|
||||
```yaml
|
||||
descripcion: "Asistente IA y MCP Server"
|
||||
tablas:
|
||||
- conversations
|
||||
- messages
|
||||
- tool_calls
|
||||
```
|
||||
| Tabla | Entity | Descripcion |
|
||||
|-------|--------|-------------|
|
||||
| referrals | Referral | Referidos |
|
||||
| referral_codes | ReferralCode | Codigos |
|
||||
| referral_rewards | ReferralReward | Recompensas |
|
||||
|
||||
### 2.14 Schema: onboarding
|
||||
### 2.14 Sales (2 tablas)
|
||||
|
||||
```yaml
|
||||
descripcion: "Flujo de configuracion inicial"
|
||||
tablas:
|
||||
- sessions
|
||||
- product_templates
|
||||
- template_imports
|
||||
```
|
||||
| Tabla | Entity | Descripcion |
|
||||
|-------|--------|-------------|
|
||||
| sales | Sale | Ventas POS |
|
||||
| sale_items | SaleItem | Items de venta |
|
||||
|
||||
### 2.15 Schema: predictions
|
||||
### 2.15 Subscriptions (4 tablas)
|
||||
|
||||
```yaml
|
||||
descripcion: "Predicciones de inventario"
|
||||
tablas:
|
||||
- inventory_predictions
|
||||
- reorder_suggestions
|
||||
- demand_history
|
||||
```
|
||||
| Tabla | Entity | Descripcion |
|
||||
|-------|--------|-------------|
|
||||
| plans | Plan | Planes de suscripcion |
|
||||
| subscriptions | Subscription | Suscripciones |
|
||||
| token_balances | TokenBalance | Balance de tokens IA |
|
||||
| token_usages | TokenUsage | Uso de tokens |
|
||||
|
||||
---
|
||||
|
||||
## 3. TABLAS PRINCIPALES
|
||||
|
||||
### 3.1 users
|
||||
|
||||
```yaml
|
||||
tabla: "users"
|
||||
schema: "public"
|
||||
descripcion: "Usuarios del sistema (duenos de changarritos)"
|
||||
columnas:
|
||||
- nombre: "id"
|
||||
tipo: "UUID"
|
||||
pk: true
|
||||
- nombre: "email"
|
||||
tipo: "VARCHAR(255)"
|
||||
unique: true
|
||||
- nombre: "phone"
|
||||
tipo: "VARCHAR(20)"
|
||||
- nombre: "name"
|
||||
tipo: "VARCHAR(100)"
|
||||
- nombre: "created_at"
|
||||
tipo: "TIMESTAMP"
|
||||
- nombre: "updated_at"
|
||||
tipo: "TIMESTAMP"
|
||||
relaciones:
|
||||
- tabla: "stores"
|
||||
tipo: "ONE_TO_MANY"
|
||||
columna: "owner_id"
|
||||
indices:
|
||||
- nombre: "idx_users_email"
|
||||
columnas: ["email"]
|
||||
unique: true
|
||||
```
|
||||
|
||||
### 3.2 stores
|
||||
|
||||
```yaml
|
||||
tabla: "stores"
|
||||
schema: "stores"
|
||||
descripcion: "Changarritos/tiendas de los usuarios"
|
||||
columnas:
|
||||
- nombre: "id"
|
||||
tipo: "UUID"
|
||||
pk: true
|
||||
- nombre: "owner_id"
|
||||
tipo: "UUID"
|
||||
fk: "users.id"
|
||||
- nombre: "name"
|
||||
tipo: "VARCHAR(100)"
|
||||
- nombre: "type"
|
||||
tipo: "VARCHAR(50)"
|
||||
- nombre: "status"
|
||||
tipo: "VARCHAR(20)"
|
||||
relaciones:
|
||||
- tabla: "users"
|
||||
tipo: "MANY_TO_ONE"
|
||||
columna: "owner_id"
|
||||
- tabla: "products"
|
||||
tipo: "ONE_TO_MANY"
|
||||
columna: "store_id"
|
||||
```
|
||||
|
||||
### 3.3 products
|
||||
|
||||
```yaml
|
||||
tabla: "products"
|
||||
schema: "products"
|
||||
descripcion: "Productos del catalogo"
|
||||
columnas:
|
||||
- nombre: "id"
|
||||
tipo: "UUID"
|
||||
pk: true
|
||||
- nombre: "store_id"
|
||||
tipo: "UUID"
|
||||
fk: "stores.id"
|
||||
- nombre: "name"
|
||||
tipo: "VARCHAR(200)"
|
||||
- nombre: "price"
|
||||
tipo: "DECIMAL(10,2)"
|
||||
- nombre: "stock"
|
||||
tipo: "INTEGER"
|
||||
- nombre: "category_id"
|
||||
tipo: "UUID"
|
||||
fk: "categories.id"
|
||||
```
|
||||
|
||||
### 3.4 sales
|
||||
|
||||
```yaml
|
||||
tabla: "sales"
|
||||
schema: "sales"
|
||||
descripcion: "Ventas realizadas en POS"
|
||||
columnas:
|
||||
- nombre: "id"
|
||||
tipo: "UUID"
|
||||
pk: true
|
||||
- nombre: "store_id"
|
||||
tipo: "UUID"
|
||||
fk: "stores.id"
|
||||
- nombre: "total"
|
||||
tipo: "DECIMAL(10,2)"
|
||||
- nombre: "payment_method"
|
||||
tipo: "VARCHAR(20)"
|
||||
- nombre: "status"
|
||||
tipo: "VARCHAR(20)"
|
||||
- nombre: "created_at"
|
||||
tipo: "TIMESTAMP"
|
||||
```
|
||||
|
||||
### 3.5 conversations (ai)
|
||||
|
||||
```yaml
|
||||
tabla: "conversations"
|
||||
schema: "ai"
|
||||
descripcion: "Conversaciones con asistente LLM"
|
||||
columnas:
|
||||
- nombre: "id"
|
||||
tipo: "UUID"
|
||||
pk: true
|
||||
- nombre: "store_id"
|
||||
tipo: "UUID"
|
||||
fk: "stores.id"
|
||||
- nombre: "user_id"
|
||||
tipo: "UUID"
|
||||
fk: "users.id"
|
||||
- nombre: "channel"
|
||||
tipo: "VARCHAR(20)"
|
||||
- nombre: "started_at"
|
||||
tipo: "TIMESTAMP"
|
||||
- nombre: "last_message_at"
|
||||
tipo: "TIMESTAMP"
|
||||
```
|
||||
|
||||
### 3.6 inventory_predictions
|
||||
|
||||
```yaml
|
||||
tabla: "inventory_predictions"
|
||||
schema: "predictions"
|
||||
descripcion: "Cache de predicciones de demanda"
|
||||
columnas:
|
||||
- nombre: "id"
|
||||
tipo: "UUID"
|
||||
pk: true
|
||||
- nombre: "product_id"
|
||||
tipo: "UUID"
|
||||
fk: "products.id"
|
||||
- nombre: "period_start"
|
||||
tipo: "DATE"
|
||||
- nombre: "period_end"
|
||||
tipo: "DATE"
|
||||
- nombre: "predicted_demand"
|
||||
tipo: "DECIMAL(10,2)"
|
||||
- nombre: "confidence"
|
||||
tipo: "DECIMAL(3,2)"
|
||||
- nombre: "calculated_at"
|
||||
tipo: "TIMESTAMP"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. RELACIONES PRINCIPALES
|
||||
## 3. RELACIONES PRINCIPALES
|
||||
|
||||
```
|
||||
┌─────────────┐
|
||||
│ users │
|
||||
│ tenants │ (Multi-tenant root)
|
||||
└──────┬──────┘
|
||||
│ 1:N
|
||||
┌────────────┼────────────┐
|
||||
│ │ │
|
||||
┌──────▼──────┐ ┌──▼──┐ ┌──────▼───────┐
|
||||
│ stores │ │ ai. │ │ subscriptions│
|
||||
└──────┬──────┘ │conv.│ └──────────────┘
|
||||
│ 1:N └──┬──┘
|
||||
┌─────────┼─────────┬──┴────────┐
|
||||
│ │ │ │
|
||||
┌───▼───┐ ┌───▼───┐ ┌───▼───┐ ┌─────▼─────┐
|
||||
│products│ │ sales │ │orders │ │ customers │
|
||||
└───┬───┘ └───┬───┘ └───┬───┘ └─────┬─────┘
|
||||
│ │ │ │
|
||||
│ └────┴─────────┴───────────┘
|
||||
│ │
|
||||
│ ┌───────▼───────┐
|
||||
│ │ fiados │
|
||||
│ └───────────────┘
|
||||
│
|
||||
┌───▼────────────┐
|
||||
│ predictions. │
|
||||
│ inventory_pred.│
|
||||
└────────────────┘
|
||||
┌─────────────────┼─────────────────┐
|
||||
│ │ │
|
||||
┌────▼────┐ ┌─────▼─────┐ ┌──────▼──────┐
|
||||
│ users │ │ products │ │ customers │
|
||||
└─────────┘ └─────┬─────┘ └──────┬──────┘
|
||||
│ 1:N │ 1:N
|
||||
┌──────┴──────┐ │
|
||||
│ │ │
|
||||
┌────▼────┐ ┌─────▼─────┐ │
|
||||
│ sales │ │ orders │◄───┘
|
||||
└────┬────┘ └─────┬─────┘
|
||||
│ │
|
||||
┌────▼────┐ ┌─────▼─────┐
|
||||
│sale_items│ │order_items│
|
||||
└─────────┘ └───────────┘
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 5. REFERENCIAS
|
||||
## 4. INDICES Y CONSTRAINTS
|
||||
|
||||
- Especificaciones tecnicas: `docs/02-especificaciones/ARQUITECTURA-DATABASE.md`
|
||||
- Migraciones: `apps/backend/src/database/migrations/`
|
||||
- Entities: Ver @MCH_DEF_ENTITIES
|
||||
### 4.1 Indices Principales
|
||||
|
||||
```sql
|
||||
-- Multi-tenant
|
||||
CREATE INDEX idx_products_tenant ON products(tenant_id);
|
||||
CREATE INDEX idx_sales_tenant ON sales(tenant_id);
|
||||
CREATE INDEX idx_customers_tenant ON customers(tenant_id);
|
||||
|
||||
-- Busquedas frecuentes
|
||||
CREATE INDEX idx_products_barcode ON products(barcode);
|
||||
CREATE INDEX idx_sales_date ON sales(created_at);
|
||||
CREATE UNIQUE INDEX idx_users_email ON users(email);
|
||||
```
|
||||
|
||||
### 4.2 Foreign Keys
|
||||
|
||||
- Todas las tablas tienen `tenant_id` -> `tenants.id`
|
||||
- `products.category_id` -> `categories.id`
|
||||
- `sales.customer_id` -> `customers.id`
|
||||
- `sale_items.product_id` -> `products.id`
|
||||
- `fiados.customer_id` -> `customers.id`
|
||||
|
||||
---
|
||||
|
||||
*Definicion canonica v1.0.0 - MiChangarrito*
|
||||
## 5. CONFIGURACION TYPEORM
|
||||
|
||||
```yaml
|
||||
# backend/src/config/database.config.ts
|
||||
typeorm:
|
||||
type: "postgres"
|
||||
synchronize: false # Usar migrations
|
||||
logging: ["error", "warn"]
|
||||
entities: ["dist/**/*.entity.js"]
|
||||
migrations: ["dist/database/migrations/*.js"]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 6. REFERENCIAS
|
||||
|
||||
- Entities: @MCH_DEF_ENTITIES
|
||||
- Backend Inventory: orchestration/inventarios/BACKEND_INVENTORY.yml
|
||||
- Database Inventory: orchestration/inventarios/DATABASE_INVENTORY.yml
|
||||
|
||||
---
|
||||
|
||||
*Definicion canonica v2.0.0 - MiChangarrito - VALIDADO*
|
||||
|
||||
@ -4,13 +4,15 @@ type: Definition
|
||||
title: "Entities Catalog"
|
||||
simco_version: "4.0.1"
|
||||
updated_at: 2026-01-17
|
||||
validated: true
|
||||
---
|
||||
|
||||
# Entities Catalog - MiChangarrito
|
||||
|
||||
**Alias:** @MCH_DEF_ENTITIES
|
||||
**Version:** 1.0.0
|
||||
**Version:** 2.0.0
|
||||
**Ultima actualizacion:** 2026-01-17
|
||||
**Estado:** VALIDADO vs Codigo
|
||||
|
||||
---
|
||||
|
||||
@ -18,174 +20,252 @@ updated_at: 2026-01-17
|
||||
|
||||
| Metrica | Valor |
|
||||
|---------|-------|
|
||||
| **Total Entities** | 35+ |
|
||||
| **Por Modulo** | Ver seccion 2 |
|
||||
| **Total Entities** | 38 |
|
||||
| **Total Modulos con Entities** | 15 |
|
||||
| **Modulos sin Entities** | 2 (billing, widgets) |
|
||||
|
||||
---
|
||||
|
||||
## 2. ENTITIES POR MODULO
|
||||
|
||||
### 2.1 Modulo: Core/Base
|
||||
### 2.1 Modulo: Auth (2 entities)
|
||||
|
||||
| Entity | Archivo | Tabla BD | Descripcion |
|
||||
|--------|---------|----------|-------------|
|
||||
| BaseEntity | `base.entity.ts` | - | Entity base abstracta |
|
||||
| AuditEntity | `audit.entity.ts` | - | Entity con auditoria |
|
||||
| Entity | Archivo | Descripcion |
|
||||
|--------|---------|-------------|
|
||||
| Tenant | `tenant.entity.ts` | Tiendas/Changarritos (multi-tenant) |
|
||||
| User | `user.entity.ts` | Usuarios del sistema |
|
||||
|
||||
### 2.2 Modulo: Auth
|
||||
### 2.2 Modulo: Categories (1 entity)
|
||||
|
||||
| Entity | Archivo | Tabla BD | Descripcion |
|
||||
|--------|---------|----------|-------------|
|
||||
| User | `user.entity.ts` | users | Usuarios del sistema |
|
||||
| Session | `session.entity.ts` | sessions | Sesiones activas |
|
||||
| RefreshToken | `refresh-token.entity.ts` | refresh_tokens | Tokens de refresco |
|
||||
| Entity | Archivo | Descripcion |
|
||||
|--------|---------|-------------|
|
||||
| Category | `category.entity.ts` | Categorias de productos |
|
||||
|
||||
### 2.3 Modulo: Stores
|
||||
### 2.3 Modulo: CoDi-SPEI (3 entities)
|
||||
|
||||
| Entity | Archivo | Tabla BD | Descripcion |
|
||||
|--------|---------|----------|-------------|
|
||||
| Store | `store.entity.ts` | stores | Changarritos |
|
||||
| StoreSettings | `store-settings.entity.ts` | store_settings | Configuracion de tienda |
|
||||
| StoreHours | `store-hours.entity.ts` | store_hours | Horarios de operacion |
|
||||
| Entity | Archivo | Descripcion |
|
||||
|--------|---------|-------------|
|
||||
| CodiTransaction | `codi-transaction.entity.ts` | Transacciones CoDi |
|
||||
| SpeiTransaction | `spei-transaction.entity.ts` | Transacciones SPEI |
|
||||
| VirtualAccount | `virtual-account.entity.ts` | Cuentas virtuales para recepcion |
|
||||
|
||||
### 2.4 Modulo: Products
|
||||
### 2.4 Modulo: Customers (3 entities)
|
||||
|
||||
| Entity | Archivo | Tabla BD | Descripcion |
|
||||
|--------|---------|----------|-------------|
|
||||
| Product | `product.entity.ts` | products | Productos del catalogo |
|
||||
| Category | `category.entity.ts` | categories | Categorias de productos |
|
||||
| Inventory | `inventory.entity.ts` | inventory | Control de inventario |
|
||||
| Entity | Archivo | Descripcion |
|
||||
|--------|---------|-------------|
|
||||
| Customer | `customer.entity.ts` | Clientes del changarrito |
|
||||
| Fiado | `fiado.entity.ts` | Creditos/fiados otorgados |
|
||||
| FiadoPayment | `fiado-payment.entity.ts` | Pagos de fiados |
|
||||
|
||||
### 2.5 Modulo: Sales (POS)
|
||||
### 2.5 Modulo: Integrations (2 entities)
|
||||
|
||||
| Entity | Archivo | Tabla BD | Descripcion |
|
||||
|--------|---------|----------|-------------|
|
||||
| Sale | `sale.entity.ts` | sales | Ventas realizadas |
|
||||
| SaleItem | `sale-item.entity.ts` | sale_items | Items de venta |
|
||||
| Payment | `payment.entity.ts` | payments | Pagos recibidos |
|
||||
| CashRegister | `cash-register.entity.ts` | cash_registers | Caja registradora |
|
||||
| Entity | Archivo | Descripcion |
|
||||
|--------|---------|-------------|
|
||||
| TenantIntegrationCredential | `tenant-integration-credential.entity.ts` | Credenciales por tenant |
|
||||
| TenantWhatsappNumber | `tenant-whatsapp-number.entity.ts` | Numeros WhatsApp por tenant |
|
||||
|
||||
### 2.6 Modulo: Orders
|
||||
### 2.6 Modulo: Inventory (2 entities)
|
||||
|
||||
| Entity | Archivo | Tabla BD | Descripcion |
|
||||
|--------|---------|----------|-------------|
|
||||
| Order | `order.entity.ts` | orders | Pedidos |
|
||||
| OrderItem | `order-item.entity.ts` | order_items | Items del pedido |
|
||||
| Delivery | `delivery.entity.ts` | deliveries | Entregas a domicilio |
|
||||
| Entity | Archivo | Descripcion |
|
||||
|--------|---------|-------------|
|
||||
| InventoryMovement | `inventory-movement.entity.ts` | Movimientos de inventario |
|
||||
| StockAlert | `stock-alert.entity.ts` | Alertas de stock bajo |
|
||||
|
||||
### 2.7 Modulo: Customers
|
||||
### 2.7 Modulo: Invoices (3 entities)
|
||||
|
||||
| Entity | Archivo | Tabla BD | Descripcion |
|
||||
|--------|---------|----------|-------------|
|
||||
| Customer | `customer.entity.ts` | customers | Clientes del changarrito |
|
||||
| CustomerAddress | `customer-address.entity.ts` | customer_addresses | Direcciones de entrega |
|
||||
| Entity | Archivo | Descripcion |
|
||||
|--------|---------|-------------|
|
||||
| Invoice | `invoice.entity.ts` | Facturas CFDI |
|
||||
| InvoiceItem | `invoice-item.entity.ts` | Items de factura |
|
||||
| TaxConfig | `tax-config.entity.ts` | Configuracion fiscal |
|
||||
|
||||
### 2.8 Modulo: Fiados
|
||||
### 2.8 Modulo: Marketplace (6 entities)
|
||||
|
||||
| Entity | Archivo | Tabla BD | Descripcion |
|
||||
|--------|---------|----------|-------------|
|
||||
| Fiado | `fiado.entity.ts` | fiados | Creditos otorgados |
|
||||
| FiadoPayment | `fiado-payment.entity.ts` | fiado_payments | Pagos de fiados |
|
||||
| Entity | Archivo | Descripcion |
|
||||
|--------|---------|-------------|
|
||||
| Supplier | `supplier.entity.ts` | Proveedores B2B |
|
||||
| SupplierProduct | `supplier-product.entity.ts` | Productos de proveedores |
|
||||
| SupplierOrder | `supplier-order.entity.ts` | Ordenes a proveedores |
|
||||
| SupplierOrderItem | `supplier-order-item.entity.ts` | Items de orden |
|
||||
| SupplierReview | `supplier-review.entity.ts` | Resenas de proveedores |
|
||||
| SupplierFavorites | `supplier-favorites.entity.ts` | Proveedores favoritos |
|
||||
|
||||
### 2.9 Modulo: Subscriptions
|
||||
### 2.9 Modulo: Messaging (3 entities)
|
||||
|
||||
| Entity | Archivo | Tabla BD | Descripcion |
|
||||
|--------|---------|----------|-------------|
|
||||
| Plan | `plan.entity.ts` | plans | Planes de suscripcion |
|
||||
| Subscription | `subscription.entity.ts` | subscriptions | Suscripciones activas |
|
||||
| Entity | Archivo | Descripcion |
|
||||
|--------|---------|-------------|
|
||||
| Conversation | `conversation.entity.ts` | Conversaciones (WhatsApp/Chat) |
|
||||
| Message | `message.entity.ts` | Mensajes de conversacion |
|
||||
| Notification | `notification.entity.ts` | Notificaciones push/in-app |
|
||||
|
||||
### 2.10 Modulo: Tokens
|
||||
### 2.10 Modulo: Orders (2 entities)
|
||||
|
||||
| Entity | Archivo | Tabla BD | Descripcion |
|
||||
|--------|---------|----------|-------------|
|
||||
| TokenPackage | `token-package.entity.ts` | token_packages | Paquetes de tokens |
|
||||
| TokenUsage | `token-usage.entity.ts` | token_usage | Uso de tokens IA |
|
||||
| Entity | Archivo | Descripcion |
|
||||
|--------|---------|-------------|
|
||||
| Order | `order.entity.ts` | Pedidos de clientes |
|
||||
| OrderItem | `order-item.entity.ts` | Items del pedido |
|
||||
|
||||
### 2.11 Modulo: AI/MCP
|
||||
### 2.11 Modulo: Payments (1 entity)
|
||||
|
||||
| Entity | Archivo | Tabla BD | Descripcion |
|
||||
|--------|---------|----------|-------------|
|
||||
| Conversation | `conversation.entity.ts` | ai.conversations | Conversaciones con LLM |
|
||||
| Message | `message.entity.ts` | ai.messages | Mensajes de conversacion |
|
||||
| ToolCall | `tool-call.entity.ts` | ai.tool_calls | Llamadas a tools MCP |
|
||||
| Entity | Archivo | Descripcion |
|
||||
|--------|---------|-------------|
|
||||
| PaymentMethod | `payment-method.entity.ts` | Metodos de pago configurados |
|
||||
|
||||
### 2.12 Modulo: Predictions
|
||||
### 2.12 Modulo: Products (1 entity)
|
||||
|
||||
| Entity | Archivo | Tabla BD | Descripcion |
|
||||
|--------|---------|----------|-------------|
|
||||
| InventoryPrediction | `inventory-prediction.entity.ts` | predictions.inventory_predictions | Cache de predicciones |
|
||||
| ReorderSuggestion | `reorder-suggestion.entity.ts` | predictions.reorder_suggestions | Sugerencias de compra |
|
||||
| Entity | Archivo | Descripcion |
|
||||
|--------|---------|-------------|
|
||||
| Product | `product.entity.ts` | Productos del catalogo |
|
||||
|
||||
### 2.13 Modulo: Onboarding
|
||||
### 2.13 Modulo: Referrals (3 entities)
|
||||
|
||||
| Entity | Archivo | Tabla BD | Descripcion |
|
||||
|--------|---------|----------|-------------|
|
||||
| OnboardingSession | `onboarding-session.entity.ts` | onboarding.sessions | Sesiones de onboarding |
|
||||
| ProductTemplate | `product-template.entity.ts` | templates.product_templates | Templates de productos |
|
||||
| Entity | Archivo | Descripcion |
|
||||
|--------|---------|-------------|
|
||||
| Referral | `referral.entity.ts` | Referidos registrados |
|
||||
| ReferralCode | `referral-code.entity.ts` | Codigos de referido |
|
||||
| ReferralReward | `referral-reward.entity.ts` | Recompensas por referidos |
|
||||
|
||||
### 2.14 Modulo: Notifications
|
||||
### 2.14 Modulo: Sales (2 entities)
|
||||
|
||||
| Entity | Archivo | Tabla BD | Descripcion |
|
||||
|--------|---------|----------|-------------|
|
||||
| Notification | `notification.entity.ts` | notifications.notifications | Notificaciones del sistema |
|
||||
| NotificationTemplate | `notification-template.entity.ts` | notifications.templates | Templates de notificacion |
|
||||
| PushToken | `push-token.entity.ts` | notifications.push_tokens | Tokens FCM de dispositivos |
|
||||
| Entity | Archivo | Descripcion |
|
||||
|--------|---------|-------------|
|
||||
| Sale | `sale.entity.ts` | Ventas POS |
|
||||
| SaleItem | `sale-item.entity.ts` | Items de venta |
|
||||
|
||||
### 2.15 Modulo: Subscriptions (4 entities)
|
||||
|
||||
| Entity | Archivo | Descripcion |
|
||||
|--------|---------|-------------|
|
||||
| Plan | `plan.entity.ts` | Planes de suscripcion |
|
||||
| Subscription | `subscription.entity.ts` | Suscripciones activas |
|
||||
| TokenBalance | `token-balance.entity.ts` | Balance de tokens IA |
|
||||
| TokenUsage | `token-usage.entity.ts` | Uso de tokens IA |
|
||||
|
||||
---
|
||||
|
||||
## 3. RELACIONES ENTRE ENTITIES
|
||||
## 3. MODULOS SIN ENTITIES
|
||||
|
||||
| Modulo | Razon |
|
||||
|--------|-------|
|
||||
| billing | Logica de facturacion sin entity propia (usa Invoice) |
|
||||
| widgets | Componentes UI, sin persistencia |
|
||||
|
||||
---
|
||||
|
||||
## 4. RELACIONES PRINCIPALES
|
||||
|
||||
```yaml
|
||||
relaciones:
|
||||
User:
|
||||
has_many: [Store, Session, RefreshToken, Subscription]
|
||||
Tenant:
|
||||
has_many: [User, Product, Sale, Order, Customer, Subscription]
|
||||
belongs_to: []
|
||||
|
||||
Store:
|
||||
has_many: [Product, Sale, Order, Customer, Fiado, StoreSettings]
|
||||
belongs_to: [User]
|
||||
User:
|
||||
has_many: [Conversation, Notification]
|
||||
belongs_to: [Tenant]
|
||||
|
||||
Product:
|
||||
has_many: [SaleItem, OrderItem, Inventory]
|
||||
belongs_to: [Store, Category]
|
||||
has_many: [SaleItem, OrderItem, InventoryMovement]
|
||||
belongs_to: [Tenant, Category]
|
||||
|
||||
Sale:
|
||||
has_many: [SaleItem, Payment]
|
||||
belongs_to: [Store, Customer]
|
||||
has_many: [SaleItem]
|
||||
belongs_to: [Tenant, Customer]
|
||||
|
||||
Order:
|
||||
has_many: [OrderItem, Delivery]
|
||||
belongs_to: [Store, Customer]
|
||||
has_many: [OrderItem]
|
||||
belongs_to: [Tenant, Customer]
|
||||
|
||||
Customer:
|
||||
has_many: [Sale, Order, Fiado, CustomerAddress]
|
||||
belongs_to: [Store]
|
||||
has_many: [Sale, Order, Fiado]
|
||||
belongs_to: [Tenant]
|
||||
|
||||
Fiado:
|
||||
has_many: [FiadoPayment]
|
||||
belongs_to: [Store, Customer]
|
||||
belongs_to: [Tenant, Customer]
|
||||
|
||||
Conversation:
|
||||
has_many: [Message, ToolCall]
|
||||
belongs_to: [Store, User]
|
||||
has_many: [Message]
|
||||
belongs_to: [Tenant, User]
|
||||
|
||||
OnboardingSession:
|
||||
Subscription:
|
||||
has_many: []
|
||||
belongs_to: [Store]
|
||||
belongs_to: [Tenant, Plan]
|
||||
|
||||
Notification:
|
||||
has_many: []
|
||||
belongs_to: [Store, User]
|
||||
Supplier:
|
||||
has_many: [SupplierProduct, SupplierOrder, SupplierReview]
|
||||
belongs_to: []
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. REFERENCIAS
|
||||
## 5. UBICACION EN CODIGO
|
||||
|
||||
- Database Schema: @MCH_DEF_DB
|
||||
- Services: @MCH_DEF_SERVICES
|
||||
- Ubicacion: `apps/backend/src/modules/*/entities/`
|
||||
```
|
||||
backend/src/modules/
|
||||
├── auth/entities/
|
||||
│ ├── tenant.entity.ts
|
||||
│ └── user.entity.ts
|
||||
├── categories/entities/
|
||||
│ └── category.entity.ts
|
||||
├── codi-spei/entities/
|
||||
│ ├── codi-transaction.entity.ts
|
||||
│ ├── spei-transaction.entity.ts
|
||||
│ └── virtual-account.entity.ts
|
||||
├── customers/entities/
|
||||
│ ├── customer.entity.ts
|
||||
│ ├── fiado.entity.ts
|
||||
│ └── fiado-payment.entity.ts
|
||||
├── integrations/entities/
|
||||
│ ├── tenant-integration-credential.entity.ts
|
||||
│ └── tenant-whatsapp-number.entity.ts
|
||||
├── inventory/entities/
|
||||
│ ├── inventory-movement.entity.ts
|
||||
│ └── stock-alert.entity.ts
|
||||
├── invoices/entities/
|
||||
│ ├── invoice.entity.ts
|
||||
│ ├── invoice-item.entity.ts
|
||||
│ └── tax-config.entity.ts
|
||||
├── marketplace/entities/
|
||||
│ ├── supplier.entity.ts
|
||||
│ ├── supplier-product.entity.ts
|
||||
│ ├── supplier-order.entity.ts
|
||||
│ ├── supplier-order-item.entity.ts
|
||||
│ ├── supplier-review.entity.ts
|
||||
│ └── supplier-favorites.entity.ts
|
||||
├── messaging/entities/
|
||||
│ ├── conversation.entity.ts
|
||||
│ ├── message.entity.ts
|
||||
│ └── notification.entity.ts
|
||||
├── orders/entities/
|
||||
│ ├── order.entity.ts
|
||||
│ └── order-item.entity.ts
|
||||
├── payments/entities/
|
||||
│ └── payment-method.entity.ts
|
||||
├── products/entities/
|
||||
│ └── product.entity.ts
|
||||
├── referrals/entities/
|
||||
│ ├── referral.entity.ts
|
||||
│ ├── referral-code.entity.ts
|
||||
│ └── referral-reward.entity.ts
|
||||
├── sales/entities/
|
||||
│ ├── sale.entity.ts
|
||||
│ └── sale-item.entity.ts
|
||||
└── subscriptions/entities/
|
||||
├── plan.entity.ts
|
||||
├── subscription.entity.ts
|
||||
├── token-balance.entity.ts
|
||||
└── token-usage.entity.ts
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
*Definicion canonica v1.0.0 - MiChangarrito*
|
||||
## 6. REFERENCIAS
|
||||
|
||||
- Database Schema: @MCH_DEF_DB
|
||||
- Services: @MCH_DEF_SERVICES
|
||||
- Backend Inventory: orchestration/inventarios/BACKEND_INVENTORY.yml
|
||||
|
||||
---
|
||||
|
||||
*Definicion canonica v2.0.0 - MiChangarrito - VALIDADO*
|
||||
|
||||
@ -4,13 +4,15 @@ type: Definition
|
||||
title: "Modules Catalog"
|
||||
simco_version: "4.0.1"
|
||||
updated_at: 2026-01-17
|
||||
validated: true
|
||||
---
|
||||
|
||||
# Modules Catalog - MiChangarrito
|
||||
|
||||
**Alias:** @MCH_DEF_MODULES
|
||||
**Version:** 1.0.0
|
||||
**Version:** 2.0.0
|
||||
**Ultima actualizacion:** 2026-01-17
|
||||
**Estado:** VALIDADO vs Codigo
|
||||
|
||||
---
|
||||
|
||||
@ -18,174 +20,342 @@ updated_at: 2026-01-17
|
||||
|
||||
| Metrica | Valor |
|
||||
|---------|-------|
|
||||
| **Total Modulos** | 24 |
|
||||
| **En Produccion** | 24 |
|
||||
| **En Desarrollo** | 0 |
|
||||
| **Total Modulos Backend** | 17 |
|
||||
| **Total Controllers** | 19 |
|
||||
| **Total Services** | 18 |
|
||||
| **Total Entities** | 38 |
|
||||
|
||||
---
|
||||
|
||||
## 2. INDICE DE MODULOS
|
||||
## 2. INDICE DE MODULOS IMPLEMENTADOS
|
||||
|
||||
### 2.1 Modulos Core (Fase 1)
|
||||
|
||||
| ID | Nombre | Estado | Epica |
|
||||
|----|--------|--------|-------|
|
||||
| MCH-M01 | Auth | Produccion | MCH-002 |
|
||||
| MCH-M02 | Users | Produccion | MCH-001 |
|
||||
| MCH-M03 | Stores | Produccion | MCH-001 |
|
||||
| MCH-M04 | Products | Produccion | MCH-003 |
|
||||
| MCH-M05 | Sales (POS) | Produccion | MCH-004 |
|
||||
| MCH-M06 | Payments | Produccion | MCH-005 |
|
||||
|
||||
### 2.2 Modulos Inteligencia (Fase 2-3)
|
||||
|
||||
| ID | Nombre | Estado | Epica |
|
||||
|----|--------|--------|-------|
|
||||
| MCH-M07 | Onboarding | Produccion | MCH-006 |
|
||||
| MCH-M08 | Templates | Produccion | MCH-007 |
|
||||
| MCH-M09 | Fiados | Produccion | MCH-008 |
|
||||
| MCH-M10 | Predictions | Produccion | MCH-009 |
|
||||
| MCH-M11 | MCP Server | Produccion | MCH-010 |
|
||||
| MCH-M12 | WhatsApp | Produccion | MCH-011 |
|
||||
| MCH-M13 | LLM Chat | Produccion | MCH-012/013 |
|
||||
| MCH-M13a | Analytics | Produccion | MCH-016 |
|
||||
|
||||
### 2.3 Modulos Negocio (Fase 4-5)
|
||||
|
||||
| ID | Nombre | Estado | Epica |
|
||||
|----|--------|--------|-------|
|
||||
| MCH-M14 | Customers | Produccion | MCH-014 |
|
||||
| MCH-M15 | Orders | Produccion | MCH-015 |
|
||||
| MCH-M16 | Deliveries | Produccion | MCH-016 |
|
||||
| MCH-M17 | Notifications | Produccion | MCH-017 |
|
||||
| MCH-M18 | Subscriptions | Produccion | MCH-018/019/020 |
|
||||
| MCH-M19 | Offline | Produccion | MCH-022 |
|
||||
| MCH-M20 | Referrals | Produccion | MCH-023 |
|
||||
| MCH-M21 | CoDi/SPEI | Produccion | MCH-024 |
|
||||
| MCH-M22 | Widgets | Produccion | MCH-025 |
|
||||
| MCH-M23 | i18n | Produccion | MCH-026 |
|
||||
| MCH-M24 | SAT/Facturacion | Produccion | MCH-027 |
|
||||
| # | Modulo | Entities | Services | Controllers | Estado |
|
||||
|---|--------|----------|----------|-------------|--------|
|
||||
| 1 | auth | 2 | 1 | 1 | Produccion |
|
||||
| 2 | billing | 0 | 1 | 1 | Produccion |
|
||||
| 3 | categories | 1 | 1 | 1 | Produccion |
|
||||
| 4 | codi-spei | 3 | 1 | 1 | Produccion |
|
||||
| 5 | customers | 3 | 1 | 1 | Produccion |
|
||||
| 6 | integrations | 2 | 1 | 2 | Produccion |
|
||||
| 7 | inventory | 2 | 1 | 1 | Produccion |
|
||||
| 8 | invoices | 3 | 1 | 1 | Produccion |
|
||||
| 9 | marketplace | 6 | 1 | 1 | Produccion |
|
||||
| 10 | messaging | 3 | 1 | 1 | Produccion |
|
||||
| 11 | orders | 2 | 1 | 1 | Produccion |
|
||||
| 12 | payments | 1 | 2 | 2 | Produccion |
|
||||
| 13 | products | 1 | 1 | 1 | Produccion |
|
||||
| 14 | referrals | 3 | 1 | 1 | Produccion |
|
||||
| 15 | sales | 2 | 1 | 1 | Produccion |
|
||||
| 16 | subscriptions | 4 | 1 | 1 | Produccion |
|
||||
| 17 | widgets | 0 | 1 | 1 | Produccion |
|
||||
|
||||
---
|
||||
|
||||
## 3. DETALLE POR MODULO
|
||||
|
||||
### MCH-M01: Auth
|
||||
### 3.1 auth
|
||||
|
||||
```yaml
|
||||
modulo:
|
||||
id: "MCH-M01"
|
||||
nombre: "Authentication"
|
||||
nombre: "auth"
|
||||
ruta: "backend/src/modules/auth"
|
||||
estado: "produccion"
|
||||
version: "1.0.0"
|
||||
|
||||
documentacion:
|
||||
especificacion: "docs/01-epicas/MCH-002-autenticacion.md"
|
||||
requerimientos: ["RF-AUTH-001", "RF-AUTH-002"]
|
||||
descripcion: "Autenticacion JWT multi-tenant"
|
||||
|
||||
objetos:
|
||||
tablas: ["users", "sessions", "refresh_tokens"]
|
||||
entities: ["User", "Session", "RefreshToken"]
|
||||
services: ["AuthService", "JwtService", "SessionService"]
|
||||
controllers: ["AuthController"]
|
||||
entities: [Tenant, User]
|
||||
services: [AuthService]
|
||||
controllers: [AuthController]
|
||||
guards: [JwtAuthGuard]
|
||||
strategies: [JwtStrategy]
|
||||
|
||||
dependencias:
|
||||
modulos: []
|
||||
externos: ["@nestjs/jwt", "@nestjs/passport"]
|
||||
endpoints:
|
||||
- POST /v1/auth/register
|
||||
- POST /v1/auth/login
|
||||
- POST /v1/auth/refresh
|
||||
- POST /v1/auth/change-pin
|
||||
```
|
||||
|
||||
### MCH-M05: Sales (POS)
|
||||
### 3.2 billing
|
||||
|
||||
```yaml
|
||||
modulo:
|
||||
id: "MCH-M05"
|
||||
nombre: "Punto de Venta"
|
||||
nombre: "billing"
|
||||
ruta: "backend/src/modules/billing"
|
||||
estado: "produccion"
|
||||
version: "1.0.0"
|
||||
|
||||
documentacion:
|
||||
especificacion: "docs/01-epicas/MCH-004-punto-venta.md"
|
||||
requerimientos: ["RF-POS-001", "RF-POS-002", "RF-POS-003"]
|
||||
descripcion: "Facturacion CFDI 4.0"
|
||||
|
||||
objetos:
|
||||
tablas: ["sales", "sale_items", "payments", "cash_registers"]
|
||||
entities: ["Sale", "SaleItem", "Payment", "CashRegister"]
|
||||
services: ["SalesService", "PaymentsService", "CashRegisterService"]
|
||||
controllers: ["SalesController", "PaymentsController"]
|
||||
|
||||
dependencias:
|
||||
modulos: ["MCH-M04", "MCH-M14"]
|
||||
externos: ["stripe"]
|
||||
entities: []
|
||||
services: [BillingService]
|
||||
controllers: [BillingController]
|
||||
```
|
||||
|
||||
### MCH-M09: Fiados
|
||||
### 3.3 categories
|
||||
|
||||
```yaml
|
||||
modulo:
|
||||
id: "MCH-M09"
|
||||
nombre: "Sistema Fiados"
|
||||
nombre: "categories"
|
||||
ruta: "backend/src/modules/categories"
|
||||
estado: "produccion"
|
||||
version: "1.0.0"
|
||||
|
||||
documentacion:
|
||||
especificacion: "docs/01-epicas/MCH-008-sistema-fiados.md"
|
||||
descripcion: "Categorias de productos"
|
||||
|
||||
objetos:
|
||||
tablas: ["fiados", "fiado_payments", "credit_limits"]
|
||||
entities: ["Fiado", "FiadoPayment", "CreditLimit"]
|
||||
services: ["FiadosService", "CreditService"]
|
||||
controllers: ["FiadosController"]
|
||||
entities: [Category]
|
||||
services: [CategoriesService]
|
||||
controllers: [CategoriesController]
|
||||
|
||||
dependencias:
|
||||
modulos: ["MCH-M14", "MCH-M05"]
|
||||
externos: []
|
||||
endpoints:
|
||||
- GET /v1/categories
|
||||
- GET /v1/categories/:id
|
||||
- POST /v1/categories
|
||||
- PUT /v1/categories/:id
|
||||
- DELETE /v1/categories/:id
|
||||
```
|
||||
|
||||
### MCH-M10: Predictions
|
||||
### 3.4 codi-spei
|
||||
|
||||
```yaml
|
||||
modulo:
|
||||
id: "MCH-M10"
|
||||
nombre: "Predictions"
|
||||
nombre: "codi-spei"
|
||||
ruta: "backend/src/modules/codi-spei"
|
||||
estado: "produccion"
|
||||
version: "1.0.0"
|
||||
|
||||
documentacion:
|
||||
especificacion: "docs/01-epicas/MCH-009-prediccion-inventario.md"
|
||||
descripcion: "Pagos CoDi y transferencias SPEI"
|
||||
|
||||
objetos:
|
||||
tablas: ["inventory_predictions", "reorder_suggestions"]
|
||||
entities: ["InventoryPrediction", "ReorderSuggestion"]
|
||||
services: ["PredictionsService", "ReorderService", "AlertsService"]
|
||||
controllers: ["PredictionsController"]
|
||||
|
||||
dependencias:
|
||||
modulos: ["MCH-M04", "MCH-M05"]
|
||||
externos: []
|
||||
entities: [CodiTransaction, SpeiTransaction, VirtualAccount]
|
||||
services: [CodiSpeiService]
|
||||
controllers: [CodiSpeiController]
|
||||
```
|
||||
|
||||
### MCH-M11: MCP Server
|
||||
### 3.5 customers
|
||||
|
||||
```yaml
|
||||
modulo:
|
||||
id: "MCH-M11"
|
||||
nombre: "MCP Server"
|
||||
nombre: "customers"
|
||||
ruta: "backend/src/modules/customers"
|
||||
estado: "produccion"
|
||||
version: "1.0.0"
|
||||
|
||||
documentacion:
|
||||
especificacion: "docs/01-epicas/MCH-010-mcp-server.md"
|
||||
requerimientos: ["RF-MCP-001", "RF-MCP-002"]
|
||||
descripcion: "Clientes y sistema de fiados"
|
||||
|
||||
objetos:
|
||||
tablas: ["conversations", "messages", "tool_calls"]
|
||||
entities: ["Conversation", "Message", "ToolCall"]
|
||||
services: ["MCPService", "ToolsService", "ConversationsService"]
|
||||
controllers: ["MCPController"]
|
||||
entities: [Customer, Fiado, FiadoPayment]
|
||||
services: [CustomersService]
|
||||
controllers: [CustomersController]
|
||||
|
||||
dependencias:
|
||||
modulos: ["MCH-M04", "MCH-M05", "MCH-M09", "MCH-M14"]
|
||||
externos: ["openrouter", "@anthropic-ai/sdk"]
|
||||
endpoints:
|
||||
- GET /v1/customers
|
||||
- GET /v1/customers/:id
|
||||
- POST /v1/customers
|
||||
- PUT /v1/customers/:id
|
||||
- DELETE /v1/customers/:id
|
||||
- GET /v1/customers/:id/fiados
|
||||
- POST /v1/customers/:id/fiados
|
||||
```
|
||||
|
||||
### 3.6 integrations
|
||||
|
||||
```yaml
|
||||
modulo:
|
||||
nombre: "integrations"
|
||||
ruta: "backend/src/modules/integrations"
|
||||
estado: "produccion"
|
||||
descripcion: "Integraciones externas por tenant"
|
||||
|
||||
objetos:
|
||||
entities: [TenantIntegrationCredential, TenantWhatsappNumber]
|
||||
services: [TenantIntegrationsService]
|
||||
controllers: [IntegrationsController, InternalIntegrationsController]
|
||||
```
|
||||
|
||||
### 3.7 inventory
|
||||
|
||||
```yaml
|
||||
modulo:
|
||||
nombre: "inventory"
|
||||
ruta: "backend/src/modules/inventory"
|
||||
estado: "produccion"
|
||||
descripcion: "Control de stock y alertas"
|
||||
|
||||
objetos:
|
||||
entities: [InventoryMovement, StockAlert]
|
||||
services: [InventoryService]
|
||||
controllers: [InventoryController]
|
||||
|
||||
endpoints:
|
||||
- GET /v1/inventory/movements
|
||||
- POST /v1/inventory/adjust
|
||||
- GET /v1/inventory/alerts
|
||||
```
|
||||
|
||||
### 3.8 invoices
|
||||
|
||||
```yaml
|
||||
modulo:
|
||||
nombre: "invoices"
|
||||
ruta: "backend/src/modules/invoices"
|
||||
estado: "produccion"
|
||||
descripcion: "Facturas CFDI"
|
||||
|
||||
objetos:
|
||||
entities: [Invoice, InvoiceItem, TaxConfig]
|
||||
services: [InvoicesService]
|
||||
controllers: [InvoicesController]
|
||||
```
|
||||
|
||||
### 3.9 marketplace
|
||||
|
||||
```yaml
|
||||
modulo:
|
||||
nombre: "marketplace"
|
||||
ruta: "backend/src/modules/marketplace"
|
||||
estado: "produccion"
|
||||
descripcion: "Marketplace B2B de proveedores"
|
||||
|
||||
objetos:
|
||||
entities: [Supplier, SupplierProduct, SupplierOrder, SupplierOrderItem, SupplierReview, SupplierFavorites]
|
||||
services: [MarketplaceService]
|
||||
controllers: [MarketplaceController]
|
||||
```
|
||||
|
||||
### 3.10 messaging
|
||||
|
||||
```yaml
|
||||
modulo:
|
||||
nombre: "messaging"
|
||||
ruta: "backend/src/modules/messaging"
|
||||
estado: "produccion"
|
||||
descripcion: "Conversaciones y notificaciones"
|
||||
|
||||
objetos:
|
||||
entities: [Conversation, Message, Notification]
|
||||
services: [MessagingService]
|
||||
controllers: [MessagingController]
|
||||
```
|
||||
|
||||
### 3.11 orders
|
||||
|
||||
```yaml
|
||||
modulo:
|
||||
nombre: "orders"
|
||||
ruta: "backend/src/modules/orders"
|
||||
estado: "produccion"
|
||||
descripcion: "Pedidos de clientes"
|
||||
|
||||
objetos:
|
||||
entities: [Order, OrderItem]
|
||||
services: [OrdersService]
|
||||
controllers: [OrdersController]
|
||||
|
||||
endpoints:
|
||||
- GET /v1/orders
|
||||
- GET /v1/orders/:id
|
||||
- POST /v1/orders
|
||||
- PATCH /v1/orders/:id/status
|
||||
```
|
||||
|
||||
### 3.12 payments
|
||||
|
||||
```yaml
|
||||
modulo:
|
||||
nombre: "payments"
|
||||
ruta: "backend/src/modules/payments"
|
||||
estado: "produccion"
|
||||
descripcion: "Metodos de pago y Stripe"
|
||||
|
||||
objetos:
|
||||
entities: [PaymentMethod]
|
||||
services: [PaymentsService, StripeService]
|
||||
controllers: [PaymentsController, WebhooksController]
|
||||
```
|
||||
|
||||
### 3.13 products
|
||||
|
||||
```yaml
|
||||
modulo:
|
||||
nombre: "products"
|
||||
ruta: "backend/src/modules/products"
|
||||
estado: "produccion"
|
||||
descripcion: "Catalogo de productos"
|
||||
|
||||
objetos:
|
||||
entities: [Product]
|
||||
services: [ProductsService]
|
||||
controllers: [ProductsController]
|
||||
|
||||
endpoints:
|
||||
- GET /v1/products
|
||||
- GET /v1/products/:id
|
||||
- GET /v1/products/barcode/:barcode
|
||||
- POST /v1/products
|
||||
- PUT /v1/products/:id
|
||||
- DELETE /v1/products/:id
|
||||
- PATCH /v1/products/:id/adjust-stock
|
||||
```
|
||||
|
||||
### 3.14 referrals
|
||||
|
||||
```yaml
|
||||
modulo:
|
||||
nombre: "referrals"
|
||||
ruta: "backend/src/modules/referrals"
|
||||
estado: "produccion"
|
||||
descripcion: "Sistema de referidos"
|
||||
|
||||
objetos:
|
||||
entities: [Referral, ReferralCode, ReferralReward]
|
||||
services: [ReferralsService]
|
||||
controllers: [ReferralsController]
|
||||
```
|
||||
|
||||
### 3.15 sales
|
||||
|
||||
```yaml
|
||||
modulo:
|
||||
nombre: "sales"
|
||||
ruta: "backend/src/modules/sales"
|
||||
estado: "produccion"
|
||||
descripcion: "Punto de venta POS"
|
||||
|
||||
objetos:
|
||||
entities: [Sale, SaleItem]
|
||||
services: [SalesService]
|
||||
controllers: [SalesController]
|
||||
|
||||
endpoints:
|
||||
- GET /v1/sales
|
||||
- GET /v1/sales/:id
|
||||
- POST /v1/sales
|
||||
- GET /v1/sales/daily-summary
|
||||
```
|
||||
|
||||
### 3.16 subscriptions
|
||||
|
||||
```yaml
|
||||
modulo:
|
||||
nombre: "subscriptions"
|
||||
ruta: "backend/src/modules/subscriptions"
|
||||
estado: "produccion"
|
||||
descripcion: "Planes y tokens IA"
|
||||
|
||||
objetos:
|
||||
entities: [Plan, Subscription, TokenBalance, TokenUsage]
|
||||
services: [SubscriptionsService]
|
||||
controllers: [SubscriptionsController]
|
||||
```
|
||||
|
||||
### 3.17 widgets
|
||||
|
||||
```yaml
|
||||
modulo:
|
||||
nombre: "widgets"
|
||||
ruta: "backend/src/modules/widgets"
|
||||
estado: "produccion"
|
||||
descripcion: "Widgets y atajos"
|
||||
|
||||
objetos:
|
||||
entities: []
|
||||
services: [WidgetsService]
|
||||
controllers: [WidgetsController]
|
||||
```
|
||||
|
||||
---
|
||||
@ -193,33 +363,54 @@ modulo:
|
||||
## 4. MATRIZ DE DEPENDENCIAS
|
||||
|
||||
```
|
||||
┌────────────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┐
|
||||
│ │ Auth │ User │Store │ Prod │ Sale │ Cust │ Pred │ MCP │
|
||||
├────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
|
||||
│ Auth │ - │ -> │ │ │ │ │ │ │
|
||||
│ Users │ <- │ - │ -> │ │ │ │ │ │
|
||||
│ Stores │ │ <- │ - │ -> │ -> │ -> │ │ │
|
||||
│ Products │ │ │ <- │ - │ │ │ -> │ -> │
|
||||
│ Sales │ │ │ <- │ <- │ - │ <- │ -> │ -> │
|
||||
│ Customers │ │ │ <- │ │ -> │ - │ │ -> │
|
||||
│ Fiados │ │ │ │ │ <- │ <- │ │ -> │
|
||||
│ Orders │ │ │ <- │ <- │ │ <- │ │ │
|
||||
│ Predictions│ │ │ │ <- │ <- │ │ - │ │
|
||||
│ MCP │ │ │ │ <- │ <- │ <- │ │ - │
|
||||
└────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┘
|
||||
Leyenda: X = depende de
|
||||
|
||||
Leyenda: -> depende de, <- es dependido por
|
||||
auth cat cust inv prod sales subs mark msg
|
||||
auth -
|
||||
categories -
|
||||
customers -
|
||||
inventory - X
|
||||
products -
|
||||
sales X X X X -
|
||||
subscriptions X -
|
||||
marketplace X -
|
||||
messaging X -
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 5. REFERENCIAS
|
||||
## 5. UBICACION EN CODIGO
|
||||
|
||||
- Database: @MCH_DEF_DB
|
||||
- Entities: @MCH_DEF_ENTITIES
|
||||
- Services: @MCH_DEF_SERVICES
|
||||
- Navegacion rapida: @MCH_QUICK_MODULES
|
||||
```
|
||||
backend/src/modules/
|
||||
├── auth/
|
||||
├── billing/
|
||||
├── categories/
|
||||
├── codi-spei/
|
||||
├── customers/
|
||||
├── integrations/
|
||||
├── inventory/
|
||||
├── invoices/
|
||||
├── marketplace/
|
||||
├── messaging/
|
||||
├── orders/
|
||||
├── payments/
|
||||
├── products/
|
||||
├── referrals/
|
||||
├── sales/
|
||||
├── subscriptions/
|
||||
└── widgets/
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
*Definicion canonica v1.0.0 - MiChangarrito*
|
||||
## 6. REFERENCIAS
|
||||
|
||||
- Entities: @MCH_DEF_ENTITIES
|
||||
- Services: @MCH_DEF_SERVICES
|
||||
- Database: @MCH_DEF_DB
|
||||
- Backend Inventory: orchestration/inventarios/BACKEND_INVENTORY.yml
|
||||
|
||||
---
|
||||
|
||||
*Definicion canonica v2.0.0 - MiChangarrito - VALIDADO*
|
||||
|
||||
@ -4,13 +4,15 @@ type: Definition
|
||||
title: "Services Catalog"
|
||||
simco_version: "4.0.1"
|
||||
updated_at: 2026-01-17
|
||||
validated: true
|
||||
---
|
||||
|
||||
# Services Catalog - MiChangarrito
|
||||
|
||||
**Alias:** @MCH_DEF_SERVICES
|
||||
**Version:** 1.0.0
|
||||
**Version:** 2.0.0
|
||||
**Ultima actualizacion:** 2026-01-17
|
||||
**Estado:** VALIDADO vs Codigo
|
||||
|
||||
---
|
||||
|
||||
@ -18,117 +20,115 @@ updated_at: 2026-01-17
|
||||
|
||||
| Metrica | Valor |
|
||||
|---------|-------|
|
||||
| **Total Services** | 30+ |
|
||||
| **Total Services** | 18 |
|
||||
| **Por Modulo** | Ver seccion 2 |
|
||||
|
||||
---
|
||||
|
||||
## 2. SERVICES POR MODULO
|
||||
|
||||
### 2.1 Modulo: Auth
|
||||
### 2.1 Auth
|
||||
|
||||
| Service | Archivo | Dependencias | Descripcion |
|
||||
|---------|---------|--------------|-------------|
|
||||
| AuthService | `auth.service.ts` | JwtService, UsersService | Autenticacion de usuarios |
|
||||
| JwtService | `jwt.service.ts` | ConfigService | Generacion/validacion JWT |
|
||||
| SessionService | `session.service.ts` | Repository | Gestion de sesiones |
|
||||
| Service | Archivo | Descripcion |
|
||||
|---------|---------|-------------|
|
||||
| AuthService | `auth.service.ts` | Autenticacion JWT, registro, login |
|
||||
|
||||
### 2.2 Modulo: Users
|
||||
### 2.2 Billing
|
||||
|
||||
| Service | Archivo | Dependencias | Descripcion |
|
||||
|---------|---------|--------------|-------------|
|
||||
| UsersService | `users.service.ts` | Repository | CRUD de usuarios |
|
||||
| Service | Archivo | Descripcion |
|
||||
|---------|---------|-------------|
|
||||
| BillingService | `billing.service.ts` | Facturacion CFDI 4.0 |
|
||||
|
||||
### 2.3 Modulo: Stores
|
||||
### 2.3 Categories
|
||||
|
||||
| Service | Archivo | Dependencias | Descripcion |
|
||||
|---------|---------|--------------|-------------|
|
||||
| StoresService | `stores.service.ts` | Repository | CRUD de tiendas |
|
||||
| StoreSettingsService | `store-settings.service.ts` | Repository | Configuracion de tiendas |
|
||||
| Service | Archivo | Descripcion |
|
||||
|---------|---------|-------------|
|
||||
| CategoriesService | `categories.service.ts` | CRUD de categorias |
|
||||
|
||||
### 2.4 Modulo: Products
|
||||
### 2.4 CoDi-SPEI
|
||||
|
||||
| Service | Archivo | Dependencias | Descripcion |
|
||||
|---------|---------|--------------|-------------|
|
||||
| ProductsService | `products.service.ts` | Repository | CRUD de productos |
|
||||
| CategoriesService | `categories.service.ts` | Repository | CRUD de categorias |
|
||||
| InventoryService | `inventory.service.ts` | Repository | Control de stock |
|
||||
| Service | Archivo | Descripcion |
|
||||
|---------|---------|-------------|
|
||||
| CodiSpeiService | `codi-spei.service.ts` | Transacciones CoDi y SPEI |
|
||||
|
||||
### 2.5 Modulo: Sales (POS)
|
||||
### 2.5 Customers
|
||||
|
||||
| Service | Archivo | Dependencias | Descripcion |
|
||||
|---------|---------|--------------|-------------|
|
||||
| SalesService | `sales.service.ts` | Repository, ProductsService | Procesamiento de ventas |
|
||||
| PaymentsService | `payments.service.ts` | StripeService | Procesamiento de pagos |
|
||||
| CashRegisterService | `cash-register.service.ts` | Repository | Control de caja |
|
||||
| Service | Archivo | Descripcion |
|
||||
|---------|---------|-------------|
|
||||
| CustomersService | `customers.service.ts` | CRUD de clientes y fiados |
|
||||
|
||||
### 2.6 Modulo: Customers
|
||||
### 2.6 Integrations
|
||||
|
||||
| Service | Archivo | Dependencias | Descripcion |
|
||||
|---------|---------|--------------|-------------|
|
||||
| CustomersService | `customers.service.ts` | Repository | CRUD de clientes |
|
||||
| Service | Archivo | Descripcion |
|
||||
|---------|---------|-------------|
|
||||
| TenantIntegrationsService | `tenant-integrations.service.ts` | Credenciales por tenant |
|
||||
|
||||
### 2.7 Modulo: Fiados
|
||||
### 2.7 Inventory
|
||||
|
||||
| Service | Archivo | Dependencias | Descripcion |
|
||||
|---------|---------|--------------|-------------|
|
||||
| FiadosService | `fiados.service.ts` | Repository, CustomersService | Gestion de creditos |
|
||||
| CreditService | `credit.service.ts` | Repository | Limites de credito |
|
||||
| Service | Archivo | Descripcion |
|
||||
|---------|---------|-------------|
|
||||
| InventoryService | `inventory.service.ts` | Control de stock y movimientos |
|
||||
|
||||
### 2.8 Modulo: Orders
|
||||
### 2.8 Invoices
|
||||
|
||||
| Service | Archivo | Dependencias | Descripcion |
|
||||
|---------|---------|--------------|-------------|
|
||||
| OrdersService | `orders.service.ts` | Repository, ProductsService | Gestion de pedidos |
|
||||
| DeliveriesService | `deliveries.service.ts` | Repository | Entregas a domicilio |
|
||||
| Service | Archivo | Descripcion |
|
||||
|---------|---------|-------------|
|
||||
| InvoicesService | `invoices.service.ts` | Gestion de facturas |
|
||||
|
||||
### 2.9 Modulo: Subscriptions
|
||||
### 2.9 Marketplace
|
||||
|
||||
| Service | Archivo | Dependencias | Descripcion |
|
||||
|---------|---------|--------------|-------------|
|
||||
| SubscriptionsService | `subscriptions.service.ts` | Repository, StripeService | Gestion de suscripciones |
|
||||
| PlansService | `plans.service.ts` | Repository | CRUD de planes |
|
||||
| TokensService | `tokens.service.ts` | Repository | Gestion de tokens IA |
|
||||
| Service | Archivo | Descripcion |
|
||||
|---------|---------|-------------|
|
||||
| MarketplaceService | `marketplace.service.ts` | Proveedores B2B y ordenes |
|
||||
|
||||
### 2.10 Modulo: Integraciones
|
||||
### 2.10 Messaging
|
||||
|
||||
| Service | Archivo | Dependencias | Descripcion |
|
||||
|---------|---------|--------------|-------------|
|
||||
| WhatsAppService | `whatsapp.service.ts` | HttpService, ConfigService | Integracion Meta API |
|
||||
| LLMService | `llm.service.ts` | HttpService, ConfigService | Integracion OpenRouter |
|
||||
| StripeService | `stripe.service.ts` | Stripe SDK | Integracion Stripe |
|
||||
| Service | Archivo | Descripcion |
|
||||
|---------|---------|-------------|
|
||||
| MessagingService | `messaging.service.ts` | Conversaciones y notificaciones |
|
||||
|
||||
### 2.11 Modulo: MCP Server
|
||||
### 2.11 Orders
|
||||
|
||||
| Service | Archivo | Dependencias | Descripcion |
|
||||
|---------|---------|--------------|-------------|
|
||||
| MCPService | `mcp.service.ts` | LLMService, ToolsRegistry | Gateway LLM agnostico |
|
||||
| ToolsService | `tools.service.ts` | ProductsService, SalesService | Ejecutor de tools MCP |
|
||||
| ConversationsService | `conversations.service.ts` | Repository | Gestion de conversaciones IA |
|
||||
| Service | Archivo | Descripcion |
|
||||
|---------|---------|-------------|
|
||||
| OrdersService | `orders.service.ts` | Gestion de pedidos |
|
||||
|
||||
### 2.12 Modulo: Predictions
|
||||
### 2.12 Payments
|
||||
|
||||
| Service | Archivo | Dependencias | Descripcion |
|
||||
|---------|---------|--------------|-------------|
|
||||
| PredictionsService | `predictions.service.ts` | Repository, SalesService | Prediccion de demanda |
|
||||
| ReorderService | `reorder.service.ts` | Repository, InventoryService | Sugerencias de reorden |
|
||||
| AlertsService | `alerts.service.ts` | Repository, NotificationsService | Alertas de stock bajo |
|
||||
| Service | Archivo | Descripcion |
|
||||
|---------|---------|-------------|
|
||||
| PaymentsService | `payments.service.ts` | Metodos de pago |
|
||||
| StripeService | `stripe.service.ts` | Integracion Stripe |
|
||||
|
||||
### 2.13 Modulo: Onboarding
|
||||
### 2.13 Products
|
||||
|
||||
| Service | Archivo | Dependencias | Descripcion |
|
||||
|---------|---------|--------------|-------------|
|
||||
| OnboardingService | `onboarding.service.ts` | Repository, WhatsAppService | Flujo de onboarding |
|
||||
| OCRService | `ocr.service.ts` | GoogleVisionClient | Procesamiento de imagenes |
|
||||
| TranscriptionService | `transcription.service.ts` | WhisperClient | Transcripcion de audio |
|
||||
| Service | Archivo | Descripcion |
|
||||
|---------|---------|-------------|
|
||||
| ProductsService | `products.service.ts` | CRUD de productos |
|
||||
|
||||
### 2.14 Modulo: Notifications
|
||||
### 2.14 Referrals
|
||||
|
||||
| Service | Archivo | Dependencias | Descripcion |
|
||||
|---------|---------|--------------|-------------|
|
||||
| NotificationsService | `notifications.service.ts` | Repository, FCMService | Gestion de notificaciones |
|
||||
| FCMService | `fcm.service.ts` | Firebase Admin | Push notifications |
|
||||
| EmailService | `email.service.ts` | SendGridClient | Envio de emails |
|
||||
| Service | Archivo | Descripcion |
|
||||
|---------|---------|-------------|
|
||||
| ReferralsService | `referrals.service.ts` | Sistema de referidos |
|
||||
|
||||
### 2.15 Sales
|
||||
|
||||
| Service | Archivo | Descripcion |
|
||||
|---------|---------|-------------|
|
||||
| SalesService | `sales.service.ts` | Punto de venta |
|
||||
|
||||
### 2.16 Subscriptions
|
||||
|
||||
| Service | Archivo | Descripcion |
|
||||
|---------|---------|-------------|
|
||||
| SubscriptionsService | `subscriptions.service.ts` | Planes y tokens IA |
|
||||
|
||||
### 2.17 Widgets
|
||||
|
||||
| Service | Archivo | Descripcion |
|
||||
|---------|---------|-------------|
|
||||
| WidgetsService | `widgets.service.ts` | Widgets y atajos |
|
||||
|
||||
---
|
||||
|
||||
@ -137,66 +137,69 @@ updated_at: 2026-01-17
|
||||
```yaml
|
||||
dependencias:
|
||||
AuthService:
|
||||
inyecta:
|
||||
- JwtService
|
||||
- UsersService
|
||||
- SessionService
|
||||
inyectado_en:
|
||||
- AuthController
|
||||
- JwtAuthGuard
|
||||
inyecta: [JwtService, ConfigService]
|
||||
inyectado_en: [AuthController, JwtAuthGuard]
|
||||
|
||||
SalesService:
|
||||
inyecta:
|
||||
- ProductsService
|
||||
- InventoryService
|
||||
- PaymentsService
|
||||
inyectado_en:
|
||||
- SalesController
|
||||
- OrdersService
|
||||
inyecta: [ProductsService, InventoryService, CustomersService]
|
||||
inyectado_en: [SalesController]
|
||||
|
||||
FiadosService:
|
||||
inyecta:
|
||||
- CustomersService
|
||||
- CreditService
|
||||
inyectado_en:
|
||||
- FiadosController
|
||||
- SalesService
|
||||
CustomersService:
|
||||
inyecta: [Repository]
|
||||
inyectado_en: [CustomersController, SalesService]
|
||||
|
||||
WhatsAppService:
|
||||
inyecta:
|
||||
- HttpService
|
||||
- ConfigService
|
||||
- LLMService
|
||||
inyectado_en:
|
||||
- WhatsAppController
|
||||
- OrdersService
|
||||
- NotificationsService
|
||||
InventoryService:
|
||||
inyecta: [ProductsService]
|
||||
inyectado_en: [InventoryController, SalesService]
|
||||
|
||||
MCPService:
|
||||
inyecta:
|
||||
- LLMService
|
||||
- ToolsService
|
||||
inyectado_en:
|
||||
- WhatsAppService
|
||||
- ChatController
|
||||
SubscriptionsService:
|
||||
inyecta: [StripeService, Repository]
|
||||
inyectado_en: [SubscriptionsController]
|
||||
|
||||
PredictionsService:
|
||||
inyecta:
|
||||
- SalesService
|
||||
- InventoryService
|
||||
inyectado_en:
|
||||
- MCPService
|
||||
- ReportsController
|
||||
MarketplaceService:
|
||||
inyecta: [Repository]
|
||||
inyectado_en: [MarketplaceController]
|
||||
|
||||
MessagingService:
|
||||
inyecta: [Repository, NotificationGateway]
|
||||
inyectado_en: [MessagingController]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. REFERENCIAS
|
||||
## 4. UBICACION EN CODIGO
|
||||
|
||||
- Entities: @MCH_DEF_ENTITIES
|
||||
- Controllers: Ver documentacion API en `/api/docs`
|
||||
- Ubicacion: `apps/backend/src/modules/*/services/`
|
||||
```
|
||||
backend/src/modules/
|
||||
├── auth/auth.service.ts
|
||||
├── billing/billing.service.ts
|
||||
├── categories/categories.service.ts
|
||||
├── codi-spei/codi-spei.service.ts
|
||||
├── customers/customers.service.ts
|
||||
├── integrations/tenant-integrations.service.ts
|
||||
├── inventory/inventory.service.ts
|
||||
├── invoices/invoices.service.ts
|
||||
├── marketplace/marketplace.service.ts
|
||||
├── messaging/messaging.service.ts
|
||||
├── orders/orders.service.ts
|
||||
├── payments/
|
||||
│ ├── payments.service.ts
|
||||
│ └── stripe.service.ts
|
||||
├── products/products.service.ts
|
||||
├── referrals/referrals.service.ts
|
||||
├── sales/sales.service.ts
|
||||
├── subscriptions/subscriptions.service.ts
|
||||
└── widgets/widgets.service.ts
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
*Definicion canonica v1.0.0 - MiChangarrito*
|
||||
## 5. REFERENCIAS
|
||||
|
||||
- Entities: @MCH_DEF_ENTITIES
|
||||
- Modules: @MCH_DEF_MODULES
|
||||
- Backend Inventory: orchestration/inventarios/BACKEND_INVENTORY.yml
|
||||
|
||||
---
|
||||
|
||||
*Definicion canonica v2.0.0 - MiChangarrito - VALIDADO*
|
||||
|
||||
@ -1,13 +1,14 @@
|
||||
# Indice de Definiciones del Proyecto
|
||||
# Proyecto: michangarrito
|
||||
# Fecha: 2026-01-16
|
||||
# Fecha: 2026-01-17
|
||||
# Estado: VALIDADO vs Codigo
|
||||
|
||||
version: "1.1.0"
|
||||
version: "2.0.0"
|
||||
simco_version: "4.0.1"
|
||||
proyecto: "michangarrito"
|
||||
fecha_creacion: "2026-01-16"
|
||||
fecha_actualizacion: "2026-01-17"
|
||||
descripcion: "Definiciones canonicas del proyecto MiChangarrito"
|
||||
descripcion: "Definiciones canonicas del proyecto MiChangarrito - VALIDADAS"
|
||||
|
||||
# ============================================================================
|
||||
# REFERENCIAS A WORKSPACE (Definiciones Globales)
|
||||
@ -24,41 +25,36 @@ referencias_workspace:
|
||||
devops: "@WS_DEF_VAL_DEVOPS"
|
||||
|
||||
# ============================================================================
|
||||
# DEFINICIONES LOCALES DEL PROYECTO
|
||||
# DEFINICIONES LOCALES DEL PROYECTO (VALIDADAS)
|
||||
# ============================================================================
|
||||
definiciones_locales:
|
||||
database:
|
||||
archivo: "DATABASE-SCHEMA.md"
|
||||
alias: "@MCH_DEF_DB"
|
||||
descripcion: "Schema canonico de base de datos MiChangarrito"
|
||||
tablas_principales:
|
||||
- users
|
||||
- stores
|
||||
- products
|
||||
- sales
|
||||
- orders
|
||||
- customers
|
||||
- fiados
|
||||
- subscriptions
|
||||
- tokens
|
||||
descripcion: "Schema de base de datos (TypeORM entities)"
|
||||
validado: true
|
||||
tablas: 38 # Corresponde 1:1 con entities
|
||||
|
||||
entities:
|
||||
archivo: "ENTITIES-CATALOG.md"
|
||||
alias: "@MCH_DEF_ENTITIES"
|
||||
descripcion: "Catalogo de entidades del proyecto"
|
||||
total_entities: 35
|
||||
validado: true
|
||||
total_entities: 38 # VALIDADO vs codigo
|
||||
|
||||
services:
|
||||
archivo: "SERVICES-CATALOG.md"
|
||||
alias: "@MCH_DEF_SERVICES"
|
||||
descripcion: "Catalogo de servicios del proyecto"
|
||||
total_services: 30
|
||||
validado: true
|
||||
total_services: 18 # VALIDADO vs codigo
|
||||
|
||||
modules:
|
||||
archivo: "MODULES-CATALOG.md"
|
||||
alias: "@MCH_DEF_MODULES"
|
||||
descripcion: "Catalogo de modulos del proyecto"
|
||||
total_modules: 24
|
||||
validado: true
|
||||
total_modules: 17 # VALIDADO vs codigo
|
||||
|
||||
# ============================================================================
|
||||
# HERENCIA (Proyecto Independiente)
|
||||
@ -69,9 +65,24 @@ herencia:
|
||||
definiciones_heredadas: []
|
||||
|
||||
# ============================================================================
|
||||
# ESTADISTICAS
|
||||
# ESTADISTICAS VALIDADAS
|
||||
# ============================================================================
|
||||
estadisticas:
|
||||
total_definiciones: 4
|
||||
total_referencias_ws: 6
|
||||
ultima_actualizacion: "2026-01-17"
|
||||
validacion:
|
||||
fecha: "2026-01-17"
|
||||
metodo: "Comparacion directa con codigo fuente"
|
||||
resultado: "COHERENTE"
|
||||
|
||||
# ============================================================================
|
||||
# METRICAS DEL CODIGO (VALIDADAS)
|
||||
# ============================================================================
|
||||
metricas_codigo:
|
||||
backend:
|
||||
modulos: 17
|
||||
entities: 38
|
||||
services: 18
|
||||
controllers: 19
|
||||
tablas_bd: 38 # 1:1 con entities
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# MASTER INVENTORY - MiChangarrito
|
||||
# Version: 4.0.0
|
||||
# Ultima actualizacion: 2026-01-10
|
||||
# Ultima actualizacion: 2026-01-17
|
||||
# Sistema: SIMCO v4.0.1 + CAPVED + SCRUM
|
||||
# Actualizado: Integracion capacidades SaaS de template-saas
|
||||
|
||||
@ -11,7 +11,7 @@ metadata:
|
||||
estado: "MVP_LISTO"
|
||||
tipo: "standalone"
|
||||
categoria: "saas"
|
||||
actualizado: "2026-01-10"
|
||||
actualizado: "2026-01-17"
|
||||
actualizado_por: "Agente Orquestador"
|
||||
|
||||
# ============================================================================
|
||||
@ -26,19 +26,20 @@ resumen:
|
||||
listo_produccion: true
|
||||
|
||||
database:
|
||||
schemas: 11
|
||||
tablas: 47 # Sincronizado con DATABASE_INVENTORY.yml
|
||||
funciones: 15
|
||||
triggers: 22
|
||||
extensiones: 4
|
||||
enums: 4
|
||||
ddl_files: 17
|
||||
schemas: 1 # public (TypeORM)
|
||||
tablas: 38 # VALIDADO - 1:1 con entities
|
||||
funciones: 0
|
||||
triggers: 0
|
||||
extensiones: 1 # uuid-ossp
|
||||
enums: 0
|
||||
ddl_files: 0 # TypeORM genera tablas
|
||||
|
||||
backend:
|
||||
modulos: 17
|
||||
controllers: 20 # Sincronizado con BACKEND_INVENTORY.yml
|
||||
modulos: 17 # VALIDADO
|
||||
controllers: 19 # VALIDADO
|
||||
endpoints: 195
|
||||
entities: 37 # Sincronizado con BACKEND_INVENTORY.yml
|
||||
entities: 38 # VALIDADO
|
||||
services: 18 # VALIDADO
|
||||
|
||||
frontend:
|
||||
paginas: 12
|
||||
|
||||
Loading…
Reference in New Issue
Block a user