mirror of
https://github.com/marcogll/AnchorOS.git
synced 2026-03-15 22:24:34 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user