feat: Implementar sistema de disponibilidad y corregir errores de kiosko

- Agregar API routes de disponibilidad (blocks, staff, time-slots, staff-unavailable)
- Corregir autenticación en availability routes (reemplazar get_current_user_role con validación Bearer)
- Corregir DELETE en blocks/route.ts para usar query parameters
- Corregir errores de tipos en kiosk routes (supabase → supabaseAdmin)
- Agregar layout raíz de Next.js y estilos globales
- Agregar componente Badge UI
- Corregir tipos TypeScript en WalkInFlow
- Instalar dependencias necesarias (@radix-ui/*, class-variance-authority, etc)
- Agregar migraciones de disponibilidad
This commit is contained in:
Marco Gallegos
2026-01-16 15:12:57 -06:00
parent 631e60376c
commit accf0e81e1
23 changed files with 8263 additions and 152 deletions

View File

@@ -55,18 +55,18 @@ CREATE OR REPLACE FUNCTION generate_kiosk_api_key()
RETURNS VARCHAR(64) AS $$
DECLARE
chars VARCHAR(62) := 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
api_key VARCHAR(64);
v_api_key VARCHAR(64);
attempts INT := 0;
max_attempts INT := 10;
BEGIN
LOOP
api_key := '';
v_api_key := '';
FOR i IN 1..64 LOOP
api_key := api_key || substr(chars, floor(random() * 62 + 1)::INT, 1);
v_api_key := v_api_key || substr(chars, floor(random() * 62 + 1)::INT, 1);
END LOOP;
IF NOT EXISTS (SELECT 1 FROM kiosks WHERE api_key = api_key) THEN
RETURN api_key;
IF NOT EXISTS (SELECT 1 FROM kiosks WHERE api_key = v_api_key) THEN
RETURN v_api_key;
END IF;
attempts := attempts + 1;