michangarrito/docs/_definitions/MODULES-CATALOG.md
rckrdmrd 5552e64ce6 [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>
2026-01-17 05:10:29 -06:00

417 lines
8.5 KiB
Markdown

---
id: DEF-MCH-MODULES
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:** 2.0.0
**Ultima actualizacion:** 2026-01-17
**Estado:** VALIDADO vs Codigo
---
## 1. RESUMEN
| Metrica | Valor |
|---------|-------|
| **Total Modulos Backend** | 17 |
| **Total Controllers** | 19 |
| **Total Services** | 18 |
| **Total Entities** | 38 |
---
## 2. INDICE DE MODULOS IMPLEMENTADOS
| # | 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
### 3.1 auth
```yaml
modulo:
nombre: "auth"
ruta: "backend/src/modules/auth"
estado: "produccion"
descripcion: "Autenticacion JWT multi-tenant"
objetos:
entities: [Tenant, User]
services: [AuthService]
controllers: [AuthController]
guards: [JwtAuthGuard]
strategies: [JwtStrategy]
endpoints:
- POST /v1/auth/register
- POST /v1/auth/login
- POST /v1/auth/refresh
- POST /v1/auth/change-pin
```
### 3.2 billing
```yaml
modulo:
nombre: "billing"
ruta: "backend/src/modules/billing"
estado: "produccion"
descripcion: "Facturacion CFDI 4.0"
objetos:
entities: []
services: [BillingService]
controllers: [BillingController]
```
### 3.3 categories
```yaml
modulo:
nombre: "categories"
ruta: "backend/src/modules/categories"
estado: "produccion"
descripcion: "Categorias de productos"
objetos:
entities: [Category]
services: [CategoriesService]
controllers: [CategoriesController]
endpoints:
- GET /v1/categories
- GET /v1/categories/:id
- POST /v1/categories
- PUT /v1/categories/:id
- DELETE /v1/categories/:id
```
### 3.4 codi-spei
```yaml
modulo:
nombre: "codi-spei"
ruta: "backend/src/modules/codi-spei"
estado: "produccion"
descripcion: "Pagos CoDi y transferencias SPEI"
objetos:
entities: [CodiTransaction, SpeiTransaction, VirtualAccount]
services: [CodiSpeiService]
controllers: [CodiSpeiController]
```
### 3.5 customers
```yaml
modulo:
nombre: "customers"
ruta: "backend/src/modules/customers"
estado: "produccion"
descripcion: "Clientes y sistema de fiados"
objetos:
entities: [Customer, Fiado, FiadoPayment]
services: [CustomersService]
controllers: [CustomersController]
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]
```
---
## 4. MATRIZ DE DEPENDENCIAS
```
Leyenda: X = depende de
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. UBICACION EN CODIGO
```
backend/src/modules/
├── auth/
├── billing/
├── categories/
├── codi-spei/
├── customers/
├── integrations/
├── inventory/
├── invoices/
├── marketplace/
├── messaging/
├── orders/
├── payments/
├── products/
├── referrals/
├── sales/
├── subscriptions/
└── widgets/
```
---
## 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*