Actualiza catálogos de definiciones técnicas con nuevos módulos, servicios, entidades y esquemas de base de datos. Cambios por archivo: DATABASE-SCHEMA.md (+138 líneas): - Agregado simco_version: 4.0.1 - Schemas: 12 -> 15 (ai, onboarding, predictions) - Tablas: ~49 -> ~65 - Nuevas tablas documentadas: conversations, inventory_predictions - Diagrama de relaciones actualizado ENTITIES-CATALOG.md (+54 líneas): - Agregado simco_version: 4.0.1 - Entities: 25 -> 35+ - Nuevos módulos: AI/MCP, Predictions, Onboarding, Notifications - Relaciones actualizadas para nuevas entidades MODULES-CATALOG.md (+94 líneas): - Agregado simco_version: 4.0.1 - Módulos: 18 -> 24 - Agregados: MCH-M19 a MCH-M24 (Offline, Referrals, CoDi, Widgets, i18n, SAT) - Detalles completos de MCH-M10 (Predictions) y MCH-M11 (MCP Server) - Matriz de dependencias expandida SERVICES-CATALOG.md (+60 líneas): - Agregado simco_version: 4.0.1 - Services: 18+ -> 30+ - Nuevos módulos: MCP Server, Predictions, Onboarding, Notifications - Inyección de dependencias actualizada _INDEX.yml: - version: 1.0.0 -> 1.1.0 - Totales actualizados (entities: 35, services: 30, modules: 24) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
192 lines
5.8 KiB
Markdown
192 lines
5.8 KiB
Markdown
---
|
|
id: DEF-MCH-ENTITIES
|
|
type: Definition
|
|
title: "Entities Catalog"
|
|
simco_version: "4.0.1"
|
|
updated_at: 2026-01-17
|
|
---
|
|
|
|
# Entities Catalog - MiChangarrito
|
|
|
|
**Alias:** @MCH_DEF_ENTITIES
|
|
**Version:** 1.0.0
|
|
**Ultima actualizacion:** 2026-01-17
|
|
|
|
---
|
|
|
|
## 1. RESUMEN
|
|
|
|
| Metrica | Valor |
|
|
|---------|-------|
|
|
| **Total Entities** | 35+ |
|
|
| **Por Modulo** | Ver seccion 2 |
|
|
|
|
---
|
|
|
|
## 2. ENTITIES POR MODULO
|
|
|
|
### 2.1 Modulo: Core/Base
|
|
|
|
| Entity | Archivo | Tabla BD | Descripcion |
|
|
|--------|---------|----------|-------------|
|
|
| BaseEntity | `base.entity.ts` | - | Entity base abstracta |
|
|
| AuditEntity | `audit.entity.ts` | - | Entity con auditoria |
|
|
|
|
### 2.2 Modulo: Auth
|
|
|
|
| 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 |
|
|
|
|
### 2.3 Modulo: Stores
|
|
|
|
| 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 |
|
|
|
|
### 2.4 Modulo: Products
|
|
|
|
| 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 |
|
|
|
|
### 2.5 Modulo: Sales (POS)
|
|
|
|
| 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 |
|
|
|
|
### 2.6 Modulo: Orders
|
|
|
|
| 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 |
|
|
|
|
### 2.7 Modulo: Customers
|
|
|
|
| Entity | Archivo | Tabla BD | Descripcion |
|
|
|--------|---------|----------|-------------|
|
|
| Customer | `customer.entity.ts` | customers | Clientes del changarrito |
|
|
| CustomerAddress | `customer-address.entity.ts` | customer_addresses | Direcciones de entrega |
|
|
|
|
### 2.8 Modulo: Fiados
|
|
|
|
| Entity | Archivo | Tabla BD | Descripcion |
|
|
|--------|---------|----------|-------------|
|
|
| Fiado | `fiado.entity.ts` | fiados | Creditos otorgados |
|
|
| FiadoPayment | `fiado-payment.entity.ts` | fiado_payments | Pagos de fiados |
|
|
|
|
### 2.9 Modulo: Subscriptions
|
|
|
|
| Entity | Archivo | Tabla BD | Descripcion |
|
|
|--------|---------|----------|-------------|
|
|
| Plan | `plan.entity.ts` | plans | Planes de suscripcion |
|
|
| Subscription | `subscription.entity.ts` | subscriptions | Suscripciones activas |
|
|
|
|
### 2.10 Modulo: Tokens
|
|
|
|
| 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 |
|
|
|
|
### 2.11 Modulo: AI/MCP
|
|
|
|
| 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 |
|
|
|
|
### 2.12 Modulo: Predictions
|
|
|
|
| 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 |
|
|
|
|
### 2.13 Modulo: Onboarding
|
|
|
|
| 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 |
|
|
|
|
### 2.14 Modulo: Notifications
|
|
|
|
| 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 |
|
|
|
|
---
|
|
|
|
## 3. RELACIONES ENTRE ENTITIES
|
|
|
|
```yaml
|
|
relaciones:
|
|
User:
|
|
has_many: [Store, Session, RefreshToken, Subscription]
|
|
belongs_to: []
|
|
|
|
Store:
|
|
has_many: [Product, Sale, Order, Customer, Fiado, StoreSettings]
|
|
belongs_to: [User]
|
|
|
|
Product:
|
|
has_many: [SaleItem, OrderItem, Inventory]
|
|
belongs_to: [Store, Category]
|
|
|
|
Sale:
|
|
has_many: [SaleItem, Payment]
|
|
belongs_to: [Store, Customer]
|
|
|
|
Order:
|
|
has_many: [OrderItem, Delivery]
|
|
belongs_to: [Store, Customer]
|
|
|
|
Customer:
|
|
has_many: [Sale, Order, Fiado, CustomerAddress]
|
|
belongs_to: [Store]
|
|
|
|
Fiado:
|
|
has_many: [FiadoPayment]
|
|
belongs_to: [Store, Customer]
|
|
|
|
Conversation:
|
|
has_many: [Message, ToolCall]
|
|
belongs_to: [Store, User]
|
|
|
|
OnboardingSession:
|
|
has_many: []
|
|
belongs_to: [Store]
|
|
|
|
Notification:
|
|
has_many: []
|
|
belongs_to: [Store, User]
|
|
```
|
|
|
|
---
|
|
|
|
## 4. REFERENCIAS
|
|
|
|
- Database Schema: @MCH_DEF_DB
|
|
- Services: @MCH_DEF_SERVICES
|
|
- Ubicacion: `apps/backend/src/modules/*/entities/`
|
|
|
|
---
|
|
|
|
*Definicion canonica v1.0.0 - MiChangarrito*
|