142 lines
4.1 KiB
Markdown
142 lines
4.1 KiB
Markdown
# Entities Catalog - MiChangarrito
|
|
|
|
**Alias:** @MCH_DEF_ENTITIES
|
|
**Version:** 1.0.0
|
|
**Ultima actualizacion:** 2026-01-16
|
|
|
|
---
|
|
|
|
## 1. RESUMEN
|
|
|
|
| Metrica | Valor |
|
|
|---------|-------|
|
|
| **Total Entities** | 25 |
|
|
| **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 |
|
|
|
|
---
|
|
|
|
## 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]
|
|
```
|
|
|
|
---
|
|
|
|
## 4. REFERENCIAS
|
|
|
|
- Database Schema: @MCH_DEF_DB
|
|
- Services: @MCH_DEF_SERVICES
|
|
- Ubicacion: `apps/backend/src/modules/*/entities/`
|
|
|
|
---
|
|
|
|
*Definicion canonica v1.0.0 - MiChangarrito*
|