Commit Graph

84 Commits

Author SHA1 Message Date
2ca062b9e0 Fix: Deshabilitar useToast en SSR para evitar crash
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m6s
El problema era que useToast() no funciona en Server-Side Rendering.
Cuando los componentes se renderizaban en el servidor, crasheaba con error 500.

Cambios:
- Hacer que toast sea opcional: process.client ? useToast() : null
- Cambiar todos toast.add() a toast?.add()
- Ahora el composable funciona tanto en servidor como en cliente
2025-11-21 23:36:01 -06:00
da5032ad54 Debug: Agregar manejo robusto de errores en componentes
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m6s
- Agregar try-catch en loadLotes/loadOperaciones
- Agregar try-catch en onMounted y watch
- Agregar estado de error y mostrar mensaje en UI
- Agregar console.log detallados para debug
- Mostrar errores en tarjeta roja sin crashear la app
2025-11-21 23:30:12 -06:00
01e99609c9 Fix: Restaurar componentes completos de Lotes y Operaciones
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m5s
- Restaurar LotesTable completo con onMounted y watch
- Habilitar carga automática de datos
- Base de datos recreada con credenciales correctas
- Conexión PostgreSQL funcionando correctamente
2025-11-21 23:25:16 -06:00
120e1871e5 Test: Simplificar LotesTable para debug de hidratación
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 2m30s
Componente ultra simple sin composables complejos ni Nuxt UI
para aislar el problema de hidratación SSR.
2025-11-21 23:07:08 -06:00
039bf47d21 masiso
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m4s
2025-11-21 23:03:31 -06:00
acafcd1390 Fix: Usar nombres correctos de componentes LotesLotesTable y OperacionesOperacionesTable
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 16s
2025-11-21 23:00:19 -06:00
a385f58500 otra vez cambiesito facil de codex 2025-11-21 22:58:45 -06:00
85bcd5737c Debug: Deshabilitar onMounted y watch en componentes de tablas
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m3s
2025-11-21 22:55:17 -06:00
c5d11433e3 Debug: Importar componentes explícitamente en app.vue
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m4s
2025-11-21 22:49:51 -06:00
0857573334 Debug: Agregar console.logs a componentes de tablas
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m4s
2025-11-21 22:46:40 -06:00
c37dbc03f6 UI: Mejorar estilo del header principal
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m4s
2025-11-21 22:41:32 -06:00
f230105be3 Docs: Actualizar título del README
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m3s
2025-11-21 22:39:28 -06:00
00b508ffaf Debug: Agregar headers a tabs para verificar renderizado
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 15s
2025-11-21 20:48:09 -06:00
6f713a5ed1 Fix: Actualizar implementación de UTabs a Nuxt UI v4
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m4s
- Cambiar selectedTab de ref(0) a ref('lotes') para usar string
- Agregar propiedad value explícita a cada tab item
- Crear documento nuxt-ui-tips.md con documentación de cambios
- Los valores deben ser strings según API de v4
2025-11-21 20:44:04 -06:00
d9ea2fb18d Fix: Actualizar implementación de UModal a Nuxt UI v4
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m4s
- Cambiar v-model a v-model:open según API de v4
- Agregar slot #content requerido en todos los modales
- Corregir prop :ui para anchos personalizados (content en lugar de width)
- Aplicar clases correctas del tema para max-w-3xl y max-w-4xl
2025-11-21 20:35:58 -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
fdb01ecb0c Documentar funcionalidad de debug en README y PLAN
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 16s
- Agregar sección de botones de debug (temporales) en README
- Documentar endpoints /api/debug/reset-database y /api/debug/seed-database
- Incluir advertencias y flujos de uso recomendados
- Marcar claramente como TEMPORALES con instrucciones de no eliminar
- Actualizar PLAN con endpoints de debug en sección Completado
2025-11-21 19:55:26 -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
0f8891f77d Actualizar README y PLAN con estado actual del sistema
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 16s
README.md:
- Transformado en documentación completa del sistema de trazabilidad
- Agregadas secciones: Modelo de Datos, API Endpoints, Base de Datos
- Documentado estado de persistencia entre deploys
- Agregado próximo objetivo: Visualización del Grafo
- Actualizada estructura del proyecto
- Ejemplos de uso y configuración

PLAN_TRAZABILIDAD.md:
- Agregada sección 'Estado Actual del Proyecto' al inicio
- Lista de características completadas
- Objetivo actual claramente definido: Visualización del Grafo
- Tecnologías a considerar para implementación
2025-11-21 19:39:34 -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
f24f2373f9 Agregar botones de prueba de API en frontend
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m4s
- Botones simples para probar GET /api/lotes, /api/operaciones y trazabilidad
- Resultados se muestran en console.log del navegador
- Facilita debugging de la API desde el frontend
2025-11-21 19:28:59 -06:00
53b7eb01cb Remover eliminación forzada de volumen - BD inicializada correctamente
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 16s
Los datos ahora persistirán entre deploys.
2025-11-21 19:13:21 -06:00
7c8ba38e04 Forzar recreación de BD eliminando volumen en deploy
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 16s
Esto reinicializará la BD con los scripts corregidos.
Una vez verificado, se puede remover esta línea temporal.
2025-11-21 19:12:00 -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
808bb0589e Inicializar BD manualmente después del deploy
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 16s
Los scripts de init de Docker no se ejecutaban porque el bind mount
apunta a un directorio temporal del runner. Ahora ejecutamos los scripts
SQL manualmente después del deploy si las tablas no existen.
2025-11-21 18:59:35 -06:00
659819d0ae Trigger redeploy con nuevas variables (APP_NAME=lotes, dominio=lotes.nucleoriofrio.com)
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 16s
2025-11-21 18:57:44 -06:00
fd9515432a Cambiar dominio a lotes.nucleoriofrio.com y limpiar deploy anterior
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 16s
- Cambiar APP_NAME de 'seguidor-de-lotes' a 'lotes'
- Cambiar dominio de 'seguidor.interno.com' a 'lotes.nucleoriofrio.com'
- Agregar limpieza del deploy anterior en workflow para recrear volumen PostgreSQL
- Esto permitirá que los scripts de init de la BD se ejecuten correctamente
2025-11-21 18:56:17 -06:00
8d4898691c Agregar variables de entorno PostgreSQL al workflow
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 15s
- Agregar POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB al env
- Usar valores por defecto si no están definidos en vars/secrets
- Fix deployment error: container postgres unhealthy
2025-11-21 18:48:25 -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
e5456bf522 Fix workflow usando actions/checkout en lugar de git clone manual
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 4s
2025-11-21 14:51:45 -06:00
5709b5645d Consolidar workflow en un solo step
Some checks failed
build-and-deploy / build-and-deploy (push) Failing after 2m15s
Por bug en Gitea que no permite ejecutar múltiples steps,
se consolidó todo el proceso de build y deploy en un único step.
2025-11-21 14:48:59 -06:00
7cabbcef8a Trigger workflow con variables corregidas
Some checks failed
build-and-deploy / build (push) Successful in 8s
build-and-deploy / deploy (push) Has been cancelled
Se configuraron las variables faltantes en Gitea:
- APP_NAME: seguidordelotes
- REGISTRY_URL corregida a gitea.nucleoriofrio.com
2025-11-21 14:43:33 -06:00
654b5ae3f7 Configurar repo seguidorDeLotes desde plantilla
Some checks failed
build-and-deploy / build (push) Failing after 15s
build-and-deploy / deploy (push) Has been cancelled
- Actualizar hook de monitoreo para repo seguidorDeLotes
- Actualizar README con nombre y descripción del proyecto
- Agregar scripts de Chrome MCP y documentación
2025-11-21 13:48:21 -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
f52f9f393f Add temporary debug endpoint to inspect all headers 2025-10-13 03:40:36 -06:00
1c901fa877 Remove debug endpoint 2025-10-13 03:21:59 -06:00
96fac68c6d Enhance user metadata display with app and outpost information
- Update AuthentikUser interface to include appSlug and outpostName
- Capture x-authentik-meta-app and x-authentik-meta-outpost headers
- Improve UserMetadata component to display connection information
- Filter empty groups from groups array
- Add documentation about available Authentik headers
2025-10-13 03:20:05 -06:00
1cba2f427e Add debug endpoint to inspect Authentik headers 2025-10-13 03:16:36 -06:00
65dee7382f Add comprehensive documentation for components, Traefik and Authentik
- Document all authentication components architecture
  - UserAvatar, UserMetadata components
  - Individual action buttons with their specific functionality
  - useAuthentik() composable with full API documentation

- Explain Authentik Proxy Outpost flow
  - Forward Auth mechanism
  - Step-by-step authentication flow
  - Advantages of proxy-based authentication

- Detail Traefik routing configuration
  - Router 1: Public routes (PWA resources) with priority 100
  - Router 2: Protected routes with Authentik middleware
  - CORS and headers middleware explanation

- Add complete Authentik setup guide
  - Traefik middleware configuration
  - Authentik Provider and Application setup
  - Network configuration requirements

- Include troubleshooting section
  - Common errors and solutions
  - PWA offline functionality
  - Headers debugging
2025-10-13 03:11:46 -06:00
3f5c4bc820 Fix TypeScript errors in useAuthentik composable
- Add AuthentikUser and AuthStatusResponse interfaces
- Fix toast color from 'gray' to 'neutral' (valid color)
- Remove invalid 'timeout' property from toast.add()
- Fix toast action from 'click' to 'onClick'
- Add proper type annotations for error handling
- Replace process.server with import.meta.server
- Make email, name, uid optional in AuthentikUser interface
2025-10-13 03:05:04 -06:00
d8f70f2aa5 Refactor auth components into individual button components
- Remove StatusBadges component (badges for authenticated, connected, groups)
- Remove ActionButtons component
- Create individual button components:
  - SessionStatusButton: handles session status check
  - ProfileButton: navigates to user profile
  - LogoutButton: handles user logout
  - LoginButton: reloads page to trigger login
- Update app.vue to use new individual button components
- Improve code quality with better component separation and reusability
2025-10-13 03:00:02 -06:00
0fd25e34e6 Update offline.html with SSR+Auth limitation explanation
- Revert CacheFirst strategy back to NetworkFirst
- Add clear technical explanation in offline.html
- Explain that full offline mode requires no-auth or SPA
- Note that UI remains functional if app is already open
2025-10-13 02:45:57 -06:00
e3fc6c924a Add offline.html to public routes (no authentication required)
This allows the service worker to cache offline.html without Authentik redirecting to login.
2025-10-13 02:39:36 -06:00
496ff7630b Add offline fallback page for PWA
- Create offline.html with user-friendly offline message
- Auto-redirect when connection is restored
- Use offline.html as navigateFallback instead of root
- Include offline.html in PWA assets for precaching

This ensures users see a proper offline page when opening the app without connection, instead of a browser error.
2025-10-13 02:37:34 -06:00
ec9ccece61 Improve document caching strategy for offline navigation
- Add navigateFallbackDenylist to exclude API and auth routes
- Enhanced urlPattern to match document destination and root path
- Increase cache entries to 50 and duration to 7 days
- Add cacheableResponse for better cache control

This should enable the app to open offline after being loaded once.
2025-10-13 02:34:14 -06:00