mirror of
https://github.com/marcogll/AnchorOS.git
synced 2026-03-15 18:24:31 +00:00
Major changes: - Add customer registration with email/phone lookup (app/booking/registro) - Add customers API endpoint (app/api/customers/route) - Implement business hours for locations (mon-fri 10-7, sat 10-6, sun closed) - Fix availability function type casting issues - Add business hours utilities (lib/utils/business-hours.ts) - Update Location type to include business_hours JSONB - Add mock payment component for testing - Remove Supabase auth from booking flow - Fix /cita redirect path in booking flow Database migrations: - Add category column to services table - Add business_hours JSONB column to locations table - Fix availability functions with proper type casting - Update get_detailed_availability to use business_hours Features: - Customer lookup by email or phone - Auto-redirect to registration if customer not found - Pre-fill customer data if exists - Business hours per day of week - Location-specific opening/closing times
47 lines
1.4 KiB
SQL
47 lines
1.4 KiB
SQL
-- Seed data for testing availability
|
|
-- Execute in Supabase Dashboard: Database > SQL Editor
|
|
|
|
-- Insert sample staff if none exists
|
|
INSERT INTO staff (user_id, location_id, role, display_name, phone, is_active, is_available_for_booking, work_hours_start, work_hours_end, work_days)
|
|
SELECT
|
|
gen_random_uuid() as user_id,
|
|
id as location_id,
|
|
'artist' as role,
|
|
'Artista Demo' as display_name,
|
|
'+52 844 123 4567' as phone,
|
|
true as is_active,
|
|
true as is_available_for_booking,
|
|
'10:00'::TIME as work_hours_start,
|
|
'19:00'::TIME as work_hours_end,
|
|
'MON,TUE,WED,THU,FRI,SAT' as work_days
|
|
FROM locations
|
|
WHERE is_active = true
|
|
AND NOT EXISTS (SELECT 1 FROM staff WHERE location_id = locations.id AND display_name = 'Artista Demo')
|
|
LIMIT 1;
|
|
|
|
-- Insert sample resources if none exists
|
|
INSERT INTO resources (location_id, name, type, capacity, is_active)
|
|
SELECT
|
|
id as location_id,
|
|
'Estación Demo' as name,
|
|
'station' as type,
|
|
1 as capacity,
|
|
true as is_active
|
|
FROM locations
|
|
WHERE is_active = true
|
|
AND NOT EXISTS (SELECT 1 FROM resources WHERE location_id = locations.id AND name = 'Estación Demo')
|
|
LIMIT 1;
|
|
|
|
-- Verify results
|
|
SELECT
|
|
'Staff added' as info,
|
|
COUNT(*)::text as count
|
|
FROM staff
|
|
WHERE display_name = 'Artista Demo'
|
|
UNION ALL
|
|
SELECT
|
|
'Resources added',
|
|
COUNT(*)::text
|
|
FROM resources
|
|
WHERE name = 'Estación Demo';
|