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

@@ -552,18 +552,18 @@ CREATE OR REPLACE FUNCTION generate_short_id()
RETURNS VARCHAR(6) AS $$
DECLARE
chars VARCHAR(36) := '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
short_id VARCHAR(6);
v_short_id VARCHAR(6);
attempts INT := 0;
max_attempts INT := 10;
BEGIN
LOOP
short_id := '';
v_short_id := '';
FOR i IN 1..6 LOOP
short_id := short_id || substr(chars, floor(random() * 36 + 1)::INT, 1);
v_short_id := v_short_id || substr(chars, floor(random() * 36 + 1)::INT, 1);
END LOOP;
IF NOT EXISTS (SELECT 1 FROM bookings WHERE short_id = short_id) THEN
RETURN short_id;
IF NOT EXISTS (SELECT 1 FROM bookings WHERE short_id = v_short_id) THEN
RETURN v_short_id;
END IF;
attempts := attempts + 1;