Commit Graph

16 Commits

Author SHA1 Message Date
5b9445ca2d Simplificar configuración de PostgreSQL con cadena de conexión única
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 16s
Eliminados hacks de autenticación md5 y configuración manual de pg_hba.conf.
Ahora usa NUXT_POSTGRES_URL como secret de Gitea para conexión directa.
2025-11-22 00:31:47 -06:00
712412f944 cambios en postgress, no me esta gustando el problema de autenticacion
Some checks failed
build-and-deploy / build-and-deploy (push) Failing after 1m6s
2025-11-22 00:04:30 -06:00
b0b179d945 Debug: Agregar logging extensivo en servidor y cliente
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m6s
- Logs en useLotes() para ver cuándo se llama
- Logs en fetchLotes() para rastrear el flujo
- Logs en API /api/lotes para ver requests del servidor
- Todos los logs con emojis para fácil identificación:
  🔵 = Cliente/Composable
  🟦 = Servidor/API
   = Errores
2025-11-21 23:39:11 -06:00
f8045abb5b Documentar peculiaridades de implementación de PostgreSQL
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m4s
- Agregar sección completa sobre autenticación md5 vs scram-sha-256
- Documentar race condition entre app y PostgreSQL con retry logic
- Explicar idempotencia de scripts (schema vs seed)
- Documentar persistencia de datos y volúmenes Docker
- Incluir troubleshooting detallado de errores comunes
- Agregar diagramas de arquitectura de inicialización
- Documentar endpoints de debug temporales
- Tabla de decisiones técnicas con alternativas descartadas
- Queries útiles y comandos de backup/restore
2025-11-21 20:18:07 -06:00
81934c7088 Fix: Ejecutar schema antes de seed en botón de carga de datos
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m4s
- Endpoint seed-database ahora ejecuta 01_schema.sql primero
- Luego ejecuta 02_seed.sql
- Resuelve error cuando se presiona seed después de borrar BD
- Schema tiene CREATE TABLE IF NOT EXISTS (idempotente)

Flujo correcto:
1. Borrar BD → DROP TABLE de todo
2. Cargar datos → Crea tablas + inserta datos
2025-11-21 20:09:02 -06:00
2d532e42c6 Agregar retry logic para conexión inicial a PostgreSQL
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m4s
- Implementar 5 reintentos con 2s de delay entre cada uno
- Resolver error de autenticación en primera carga
- PostgreSQL necesita tiempo para ejecutar 00_configure_auth.sh
- App ahora espera automáticamente hasta que auth esté configurado

Esto resuelve el error 28P01 (password authentication failed)
que ocurría solo en la primera conexión después del deploy.
2025-11-21 20:04:42 -06:00
e5b2331922 Fix: Resolver problemas de inicialización y seed de BD
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m4s
Soluciones implementadas:

1. Copiar archivos SQL al contenedor Docker
   - Agregar COPY de server/database/ en Dockerfile
   - Permite que endpoint seed-database encuentre 02_seed.sql

2. Aumentar timeout de conexión PostgreSQL
   - connectionTimeoutMillis: 2000 -> 10000 (10 segundos)
   - Evita errores de autenticación en primera carga

3. Reducir logs en producción
   - Solo mostrar 'Nueva conexión' en desarrollo
   - Reduce ruido en logs de producción
2025-11-21 20:02:35 -06:00
a6672cdcd0 Modificar reset-database para DROP tablas en lugar de TRUNCATE
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 17s
Problema: Al hacer TRUNCATE, las tablas quedaban vacías pero existían,
entonces el workflow pensaba que ya estaba inicializada y no recreaba
los datos de ejemplo.

Solución: Ahora hace DROP TABLE (eliminar completamente) para que el
próximo deploy detecte que no existen tablas y las recree con el seed.

Ahora el flujo correcto es:
1. Click en 'BORRAR TODA LA BD' → DROP de todas las tablas
2. Push o redeploy → Workflow detecta que no hay tablas
3. Workflow ejecuta 01_schema.sql y 02_seed.sql automáticamente
2025-11-21 19:46:50 -06:00
3a1c3fb7a2 Agregar botones de debug temporales para gestión de BD
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 16s
⚠️ CÓDIGO TEMPORAL - NO ELIMINAR SIN CONSULTAR ⚠️

Backend:
- POST /api/debug/reset-database - Borra todos los datos
- POST /api/debug/seed-database - Carga datos de ejemplo

Frontend:
- Card rojo con advertencias notorias
- Botones: 🗑️ BORRAR TODA LA BD y 🌱 CARGAR DATOS DE EJEMPLO
- Confirmación antes de resetear
- Estados de loading
- Alertas de éxito/error

Todos los archivos marcados con comentarios muy visibles:
⚠️⚠️⚠️ NO ELIMINAR SIN CONSULTAR A DARIO/DRAGANEL/NUCLEO000 ⚠️⚠️⚠️

Útil para desarrollo y debugging del sistema de trazabilidad.
2025-11-21 19:43:04 -06:00
a14ce46ab3 Agregar configuración automática de autenticación PostgreSQL
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m3s
- Script 00_configure_auth.sh configura pg_hba.conf para usar md5
- Se ejecuta automáticamente en inicializaciones de BD
- Soluciona permanentemente problemas de autenticación con driver pg de Node.js
2025-11-21 19:33:46 -06:00
6f49b315cb Corregir script de seed: separar RETURNING en múltiples INSERT
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m3s
PostgreSQL no soporta RETURNING id INTO con múltiples variables cuando
se insertan múltiples filas. Separado en INSERT individuales.
2025-11-21 19:07:06 -06:00
30a5e1aafb Corregir imports en archivos API del servidor
Some checks failed
build-and-deploy / build-and-deploy (push) Failing after 1m4s
- Cambiar imports de ~/server/utils a rutas relativas
- Fix build error en Docker
- Build local verificado exitosamente
2025-11-21 18:46:14 -06:00
ee3dffa38e Implementar sistema completo de trazabilidad de lotes
Some checks failed
build-and-deploy / build-and-deploy (push) Failing after 1m47s
- Agregar PostgreSQL 16 con esquema completo
- Crear API endpoints para lotes y operaciones
- Implementar UI con Nuxt UI (tablas, formularios, trazabilidad)
- Agregar datos de ejemplo del flujo completo
- Documentar sistema en PLAN_TRAZABILIDAD.md
2025-11-21 18:39:04 -06:00
43bcf4a647 Add modular group verification system with frontend and backend checks
This commit implements a comprehensive, reusable group verification system:

Components:
- GroupCheckButton: Base component for group verification
- 7 specialized buttons: 3 real groups (authentik Admins, grupo-prueba, lvl0), 1 public access test, 2 system verification buttons
- All buttons support both frontend and backend verification modes

Backend:
- New API endpoint /api/auth/check-group for server-side group validation
- Reads Authentik headers and validates group membership

Frontend:
- Enhanced useAuthentik composable with hasGroup() and checkGroupBackend() methods
- Toast notifications for all verification results
- Smooth animations and color-coded visual feedback

UI Improvements:
- Organized layout with cards for different verification types
- Grid layout for group buttons
- Professional styling with hover effects and shadows
- Clear visual distinction between frontend/backend checks
2025-10-13 04:09:42 -06:00
87ae5b95e6 Improve PWA offline functionality and fix session caching
- Enable navigateFallback for offline navigation support
- Add JSON files to glob patterns for heroicons support
- Change Authentik API caching from NetworkFirst to NetworkOnly to prevent stale session data
- Add offline detection in checkSessionStatus with proper user feedback
- Add no-cache headers to /api/auth/status endpoint to prevent browser caching
- Show "Modo Offline" toast when user tries to check session while offline
2025-10-13 02:21:50 -06:00
ddea20376d Fix API endpoint location for Nuxt server structure
Move /api/auth/status endpoint from app/server/ to server/ directory.
Nuxt expects server API routes to be in /server/api/, not /app/server/api/.

This fixes the issue where the endpoint was returning HTML instead of JSON.
2025-10-13 01:33:10 -06:00