Some checks are pending
CI/CD Pipeline / Backend CI (push) Waiting to run
CI/CD Pipeline / Frontend CI (push) Waiting to run
CI/CD Pipeline / WhatsApp Service CI (push) Waiting to run
CI/CD Pipeline / Mobile CI (push) Waiting to run
CI/CD Pipeline / Docker Build (./apps/backend, ./apps/backend/Dockerfile, backend) (push) Blocked by required conditions
CI/CD Pipeline / Docker Build (./apps/frontend, ./apps/frontend/Dockerfile, frontend) (push) Blocked by required conditions
CI/CD Pipeline / Docker Build (./apps/whatsapp-service, ./apps/whatsapp-service/Dockerfile, whatsapp-service) (push) Blocked by required conditions
CI/CD Pipeline / Deploy to Production (push) Blocked by required conditions
- Move 7 non-standard folders to _archive/ - Archive 3 extra root files - Update _MAP.md with standardized structure Standard: SIMCO-ESTANDAR-ORCHESTRATION v1.0.0 Level: CONSUMER (L2) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
9.4 KiB
9.4 KiB
Plan Refinado Final - MiChangarrito FASE 2
Fecha: 2026-01-06 Version: 2.0 (Refinado) Basado en: Analisis FASE 1-4
RESUMEN EJECUTIVO
Plan de implementacion refinado que incorpora:
- Tareas adicionales identificadas en validacion
- Orden de ejecucion basado en dependencias
- Estimaciones ajustadas (+25%)
- Criterios de aceptacion completos
- Rollback plan definido
1. TAREAS CONSOLIDADAS Y ORDENADAS
BLOQUE A: Backend-Database (Dia 1)
| # | ID | Tarea | Prioridad | Horas | Checkpoint |
|---|---|---|---|---|---|
| 1 | A0 | Crear/verificar .env con credenciales DB | P0 | 0.5 | - |
| 2 | A1 | Configurar TypeORM en app.module.ts | P0 | 2 | - |
| 3 | A2 | Verificar entidades vs schemas DDL | P0 | 3 | - |
| 4 | A3 | Crear tenant.middleware.ts (RLS) | P0 | 3 | - |
| 5 | A4 | Registrar middleware en main.ts | P0 | 1 | - |
| 6 | A5 | Actualizar puerto a 3141 | P0 | 0.5 | - |
| 7 | A6 | Verificar conexion y seeds | P0 | 1 | CP1 |
| 8 | A7 | Configurar CORS (nuevo) | P0 | 1 | - |
Subtotal Bloque A: 12 horas
BLOQUE B: Frontend-Backend (Dias 2-3)
| # | ID | Tarea | Prioridad | Horas | Checkpoint |
|---|---|---|---|---|---|
| 9 | B0 | Crear .env frontend con API_URL | P0 | 0.5 | - |
| 10 | B1 | Configurar proxy en vite.config.ts | P0 | 0.5 | - |
| 11 | B2 | Actualizar api.ts con interceptors | P0 | 1 | - |
| 12 | B3.1 | Crear AuthContext.tsx (nuevo) | P0 | 2 | - |
| 13 | B3.2 | Crear Login.tsx (nuevo) | P0 | 2 | - |
| 14 | B3.3 | Crear Register.tsx (nuevo) | P0 | 2 | - |
| 15 | B3.4 | Actualizar App.tsx con rutas auth | P0 | 1 | - |
| 16 | B3.5 | Actualizar Layout.tsx con auth nav | P0 | 1 | CP2 |
| 17 | B4 | Conectar Dashboard con API real | P1 | 2 | - |
| 18 | B5 | Conectar Products con API real | P1 | 2 | - |
| 19 | B6 | Conectar Orders con API real | P1 | 2 | - |
| 20 | B7 | Conectar Customers con API real | P1 | 2 | - |
| 21 | B8 | Conectar Fiado con API real | P1 | 2 | - |
| 22 | B9 | Conectar Inventory con API real | P1 | 2 | - |
| 23 | B10 | Conectar Settings con API real | P2 | 1 | - |
| 24 | B11 | Manejo token expirado (nuevo) | P1 | 1 | CP3 |
Subtotal Bloque B: 24 horas
BLOQUE C: WhatsApp Service (Dia 4)
| # | ID | Tarea | Prioridad | Horas | Checkpoint |
|---|---|---|---|---|---|
| 25 | C0 | Actualizar .env con BACKEND_API_URL | P0 | 0.5 | - |
| 26 | C1 | Actualizar puerto a 3143 en main.ts | P0 | 0.5 | - |
| 27 | C2 | Implementar fetch productos | P1 | 2 | - |
| 28 | C3 | Implementar fetch categorias | P1 | 1 | - |
| 29 | C4 | Implementar fetch ordenes | P1 | 2 | - |
| 30 | C5 | Implementar fetch fiado | P1 | 2 | - |
| 31 | C6 | Implementar creacion ordenes | P1 | 3 | CP4 |
Subtotal Bloque C: 11 horas
BLOQUE D: MCP Server (Dia 4)
| # | ID | Tarea | Prioridad | Horas | Checkpoint |
|---|---|---|---|---|---|
| 32 | D0 | Crear/actualizar .env | P0 | 0.5 | - |
| 33 | D1 | Actualizar BACKEND_URL en index.ts | P0 | 0.5 | - |
| 34 | D2 | Probar tools con backend real | P1 | 3 | - |
| 35 | D3 | Ajustar endpoints si necesario | P1 | 2 | - |
| 36 | D4 | Documentar estado final | P2 | 1 | CP5 |
Subtotal Bloque D: 7 horas
BLOQUE E: Pruebas Integracion (Dia 5)
| # | ID | Tarea | Prioridad | Horas | Checkpoint |
|---|---|---|---|---|---|
| 37 | E1 | Test flujo registro tenant | P0 | 1 | - |
| 38 | E2 | Test flujo login/logout | P0 | 1 | - |
| 39 | E3 | Test CRUD producto | P1 | 1 | - |
| 40 | E4 | Test crear venta (POS) | P1 | 2 | - |
| 41 | E5 | Test crear pedido | P1 | 1 | - |
| 42 | E6 | Test flujo fiado | P1 | 2 | - |
| 43 | E7 | Test WhatsApp -> pedido | P1 | 2 | - |
| 44 | E8 | Test MCP tools completo | P1 | 2 | - |
| 45 | E9 | Test error handling (nuevo) | P1 | 1 | CP6 |
Subtotal Bloque E: 13 horas
2. RESUMEN ESTIMACIONES
| Bloque | Tareas | Horas | Dias (8h) |
|---|---|---|---|
| A: Backend-DB | 8 | 12 | 1.5 |
| B: Frontend | 16 | 24 | 3 |
| C: WhatsApp | 7 | 11 | 1.5 |
| D: MCP | 5 | 7 | 1 |
| E: Testing | 9 | 13 | 1.5 |
| TOTAL | 45 | 67 | 8.5 |
Con buffer 20%: 80 horas = 10 dias habiles
3. CRONOGRAMA DETALLADO
Semana 1
| Dia | Tareas | Checkpoint |
|---|---|---|
| Lun | A0-A7 | CP1: Backend conectado |
| Mar | B0-B3.5 | CP2: Auth funcional |
| Mie | B4-B11 | CP3: Frontend conectado |
| Jue | C0-C6, D0-D4 | CP4, CP5: Servicios conectados |
| Vie | E1-E9 | CP6: Tests completados |
Semana 2 (Buffer)
| Dia | Actividad |
|---|---|
| Lun | Correccion de bugs |
| Mar | Documentacion final |
| Mie | Review y ajustes |
4. DEFINICION DE CHECKPOINTS
CP1: Backend Conectado (Fin Dia 1)
Criterios:
- Backend inicia en puerto 3141
- GET /health retorna 200
- Query a tenants retorna datos
- RLS middleware activo
Comando verificacion:
curl http://localhost:3141/health
curl http://localhost:3141/api/v1/products
CP2: Auth Funcional (Fin Dia 2 AM)
Criterios:
- Pagina /login renderiza
- Pagina /register renderiza
- POST /auth/login retorna token
- Token se guarda en localStorage
Comando verificacion:
curl -X POST http://localhost:3141/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"phone":"5512345678","pin":"1234"}'
CP3: Frontend Conectado (Fin Dia 3)
Criterios:
- Dashboard muestra datos reales
- Products lista desde API
- Orders muestra pedidos
- Error 401 redirige a login
CP4: WhatsApp Conectado (Fin Dia 4 AM)
Criterios:
- Webhook responde GET
- Mensaje "hola" funciona
- Consulta productos funciona
CP5: MCP Conectado (Fin Dia 4 PM)
Criterios:
- list_products retorna datos
- create_order funciona
- get_fiado_balance funciona
CP6: Tests Completados (Fin Dia 5)
Criterios:
- 100% tests E1-E9 pasando
- Sin errores 500 en logs
- Flujos documentados
5. ARCHIVOS A CREAR (NUEVOS)
| Archivo | Contenido |
|---|---|
| apps/backend/.env | Credenciales DB |
| apps/backend/src/common/middleware/tenant.middleware.ts | RLS middleware |
| apps/frontend/.env | API URL |
| apps/frontend/src/contexts/AuthContext.tsx | Estado auth |
| apps/frontend/src/pages/Login.tsx | Pagina login |
| apps/frontend/src/pages/Register.tsx | Pagina registro |
| apps/mcp-server/.env | Backend URL |
6. ARCHIVOS A MODIFICAR
| Archivo | Cambios |
|---|---|
| apps/backend/src/app.module.ts | TypeORM config |
| apps/backend/src/main.ts | Puerto, CORS, middleware |
| apps/frontend/vite.config.ts | Proxy config |
| apps/frontend/src/lib/api.ts | Interceptors, baseURL |
| apps/frontend/src/App.tsx | Rutas protegidas |
| apps/frontend/src/components/Layout.tsx | Auth nav |
| apps/frontend/src/pages/*.tsx | API real |
| apps/whatsapp-service/src/main.ts | Puerto |
| apps/whatsapp-service/src/webhook/webhook.service.ts | Backend calls |
| apps/mcp-server/src/index.ts | Backend URL |
7. CRITERIOS DE ACEPTACION FINALES
7.1 Funcionales
- Usuario puede registrar nuevo negocio
- Usuario puede hacer login con PIN
- Usuario puede ver y crear productos
- Usuario puede registrar ventas
- Usuario puede ver pedidos
- Usuario puede gestionar fiados
- WhatsApp puede recibir y procesar mensajes
- MCP tools funcionan con datos reales
7.2 Tecnicos
- Backend conectado a PostgreSQL
- RLS funcionando (aislamiento tenant)
- JWT autenticacion funcional
- Proxy frontend->backend funcional
- Sin errores en consola (excepto warnings menores)
- Tiempo respuesta API < 500ms
7.3 Documentacion
- .env.example actualizado
- README con instrucciones setup
- Endpoints documentados en Swagger
8. RIESGOS Y MITIGACIONES
| Riesgo | Prob | Impacto | Mitigacion |
|---|---|---|---|
| Entidades no sincronizan | Alta | Alto | Revisar uno por uno |
| CORS bloquea requests | Media | Medio | Configurar origins |
| JWT invalido | Media | Alto | Logs detallados |
| WhatsApp sin cuenta | Alta | Alto | Mock para desarrollo |
| Performance lenta | Baja | Medio | Indices DB |
9. DECISION POINTS
9.1 Pre-ejecucion
Requiere respuesta del usuario:
- Hay una base de datos PostgreSQL disponible con los schemas creados?
- Se tiene acceso a cuenta WhatsApp Business o se usa mock?
- Se tiene API key de OpenAI/LLM o se desactiva temporalmente?
9.2 Durante ejecucion
Si falla CP1:
- Opcion A: Revisar credenciales y reintentar
- Opcion B: Escalar a DBA
Si falla CP2:
- Opcion A: Revisar AuthContext y reintentar
- Opcion B: Simplificar auth (solo token sin refresh)
10. ENTREGABLES FINALES
Al completar FASE 2 se entregara:
- Codigo funcional - Backend, Frontend, WhatsApp, MCP integrados
- Documentacion - README actualizado, .env.example
- Reporte de pruebas - E1-E9 documentados
- Reporte de implementacion - REPORTE-FASE2-COMPLETA.md
- Lista de pendientes - Para FASE 3 (Mobile)
11. PROXIMOS PASOS
Una vez aprobado este plan:
- Confirmar prerrequisitos (DB, API keys)
- Crear branch
feature/fase2-integration - Ejecutar Bloque A (Backend-DB)
- Commit CP1
- Continuar secuencialmente
FIN DEL PLAN REFINADO
Estado: PENDIENTE APROBACION USUARIO
Para aprobar y ejecutar, responder con: "Aprobar y ejecutar FASE 2"
Para modificar: Indicar cambios requeridos