Commit Graph

14 Commits

Author SHA1 Message Date
Adrian Flores Cortes
ef5861bedd [RBAC-005] feat: Propagate RBAC middleware from erp-core
- Add rbac.middleware.ts with requirePerm, requireAnyPerm, requireAllPerms, requireAccess, requirePermOrOwner
- Update shared middleware index exports
- Configure retail-specific roles (manager, cashier, admin, super_admin)

Propagated from erp-core TASK-2026-01-30-RBAC

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 14:58:08 -06:00
Adrian Flores Cortes
ebbe7d1d36 [RT-008] feat: Implement reports module for retail analytics
Features:
- Sales reports: by period, product, branch, cashier, payment method
- Inventory reports: stock levels, movements, valuation, turnover
- Customer reports: segmentation, RFM analysis, loyalty, retention
- Financial reports: revenue, margins, taxes, cash flow, reconciliation
- Dashboard KPIs with real-time metrics
- Scheduled reports with email/SFTP/webhook delivery
- Export formats: JSON, CSV, Excel, PDF

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 20:05:22 -06:00
Adrian Flores Cortes
113a83c6ca [ERP-RETAIL] feat(purchases): Complete module integrations - email and inventory
- Add email sending stub in supplier-order.service.ts with validation and logging
- Add emailError field to SupplierOrder entity for tracking failed attempts
- Implement purchase suggestion generation algorithm that:
  - Queries branch_stock for products below reorder point
  - Calculates average daily sales from POS order history
  - Determines suggested quantities based on max stock or sales forecast
  - Creates suggestions with priority levels (critical, high, medium, low)
- Enriches suggestions with product codes from product_barcodes table

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 18:13:26 -06:00
Adrian Flores Cortes
c6b8ab019a [ERP-RETAIL] feat(ecommerce): Add cart, order, and shipping services with controller
Implement complete ecommerce backend:
- CartService: cart CRUD, items, coupons, shipping, cart merging
- EcommerceOrderService: order creation, payment, shipping, fulfillment workflow
- ShippingRateService: rate calculation with geo/product/customer restrictions
- EcommerceController: REST API endpoints for all ecommerce operations

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 18:01:06 -06:00
Adrian Flores Cortes
c24290b0ee [SYNC] Synchronize mcp module from erp-core canonical
Source: erp-core (checksum: 9c067e47e556cc79e29a85923f8fe65b)
Priority: P1 - HIGH
Context: TASK-2026-01-25-SISTEMA-REUTILIZACION

Before: Diverged version
After: Synced with canonical

Changes:
- Complete mcp module synchronized from erp-core
- MCP Server integration unified
- Tool registry and logging standardized
- Consistent MCP protocol implementation

Benefits:
- Single source of truth for MCP functionality
- Unified Claude AI integration via MCP
- Reduced maintenance burden (~500 lines per project)
- Following erp-construccion example (already synced)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 07:02:28 -06:00
Adrian Flores Cortes
8b20d1eec1 [SYNC] Synchronize payment-terminals module from erp-core canonical
Source: erp-core (checksum: c9040e545cf55beb87d3e437a4998855)
Priority: P1 - HIGH
Context: TASK-2026-01-25-SISTEMA-REUTILIZACION

Before: Diverged version (one of 3 different versions)
After: Synced with canonical

Changes:
- Complete payment-terminals module synchronized from erp-core
- 21 TypeScript files updated
- Unified payment terminal integration (MercadoPago + Clip)
- Consistent webhook handling across all ERP projects

Benefits:
- Single source of truth for payment terminals functionality
- Consistent TPV integration behavior
- Reduced maintenance burden (~4,000 lines saved)
- Unified webhook processing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 06:52:11 -06:00
Adrian Flores Cortes
f08e60b520 [SYNC] BaseService synchronized from erp-core canonical
Source: erp-core (checksum: 900be2ee48f2faf72ce5253aeab27c88)
Priority: P1 - HIGH (architectural gap resolution)
Context: TASK-2026-01-25-SISTEMA-REUTILIZACION

Before: "Diverged version"
After: Synced with canonical

Changes:
- BaseService "synchronized" from erp-core
- Checksum: 900be2ee48f2faf72ce5253aeab27c88
- Provides base CRUD operations for all services

Benefits:
- Unified service architecture
- Consistent error handling and validation
- Reduced code duplication in service implementations
- Standard pagination and filtering patterns

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 06:43:29 -06:00
Adrian Flores Cortes
54bb752246 [SYNC] Synchronize ai module from erp-core canonical
Source: erp-core (checksum: 39a6e229055a21158b63cc4eb4dd232f)
Priority: P0 - CRITICAL divergence resolution
Context: TASK-2026-01-25-SISTEMA-REUTILIZACION

Before: Diverged version with project-specific adaptations
After: Synced with canonical

Changes:
- Complete ai module synchronized from erp-core
- 24 TypeScript files updated
- Unified role-based AI configuration
- Consistent AI behavior across all ERP projects

Note: Project-specific role adaptations (if needed) can be
re-applied as documented extensions after this sync.

Benefits:
- Single source of truth for AI functionality
- Reduced maintenance burden
- Token savings from code reuse
- Consistent behavior baseline

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 06:36:13 -06:00
Adrian Flores Cortes
aa7e5a3c78 [PROP-CORE-004] feat: Register payment-terminals module in app
- Added payment-terminals entities to TypeORM config
- Registered PaymentTerminalsModule routes in index.ts
- Updated API modules list in app.ts
- Fixed getEntities() to only reference own entities

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 03:08:09 -06:00
Adrian Flores Cortes
3514e6305c [PROP-CORE-004] feat: Adapt AI roles for retail domain
- Roles: ADMIN, GERENTE_TIENDA, CAJERO, CLIENTE
- Domain-specific tools per role (POS, sales, inventory)
- Retail terminology and Spanish names

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 02:57:42 -06:00
Adrian Flores Cortes
9de89aab5a [PROP-CORE-004] feat: Add Phase 6 modules from erp-core
Propagated modules:
- payment-terminals: MercadoPago + Clip TPV integration
- ai: Role-based AI access (ADMIN, GERENTE_TIENDA, CAJERO, CLIENTE)
- mcp: 18 ERP tools for AI assistants

71 files added. Critical for POS operations (P0).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 02:43:47 -06:00
3c089d1ae5 chore: Add .gitignore for clean repository
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 07:31:56 -06:00
a6186c4022 Migración desde erp-retail/backend - Estándar multi-repo v2
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 08:11:34 -06:00
2f59a4f951 Initial commit 2026-01-16 14:04:58 +00:00