feat: Add kiosk management, artist selection, and schedule management

- Add KiosksManagement component with full CRUD for kiosks
- Add ScheduleManagement for staff schedules with break reminders
- Update booking flow to allow artist selection by customers
- Add staff_services API for assigning services to artists
- Update staff management UI with service assignment dialog
- Add auto-break reminder when schedule >= 8 hours
- Update availability API to filter artists by service
- Add kiosk management to Aperture dashboard
- Clean up ralphy artifacts and logs
This commit is contained in:
Marco Gallegos
2026-01-21 13:02:06 -06:00
parent 24e5af3860
commit d27354fd5a
71 changed files with 3353 additions and 2701 deletions

View File

@@ -0,0 +1,127 @@
import { NextRequest, NextResponse } from 'next/server'
import { supabaseAdmin } from '@/lib/supabase/admin'
export async function GET(request: NextRequest) {
try {
const { searchParams } = new URL(request.url)
const locationId = searchParams.get('location_id')
const isActive = searchParams.get('is_active')
let query = supabaseAdmin
.from('kiosks')
.select(`
id,
device_name,
display_name,
api_key,
ip_address,
is_active,
created_at,
updated_at,
location:locations (
id,
name,
address
)
`)
.order('device_name', { ascending: true })
if (locationId) {
query = query.eq('location_id', locationId)
}
if (isActive !== null && isActive !== '') {
query = query.eq('is_active', isActive === 'true')
}
const { data: kiosks, error } = await query
if (error) {
return NextResponse.json(
{ error: error.message },
{ status: 500 }
)
}
return NextResponse.json({
success: true,
kiosks: kiosks || []
})
} catch (error) {
console.error('Kiosks GET error:', error)
return NextResponse.json(
{ error: 'Internal server error' },
{ status: 500 }
)
}
}
export async function POST(request: NextRequest) {
try {
const body = await request.json()
const { device_name, display_name, location_id, ip_address } = body
if (!device_name || !location_id) {
return NextResponse.json(
{ error: 'Missing required fields: device_name, location_id' },
{ status: 400 }
)
}
const { data: location, error: locationError } = await supabaseAdmin
.from('locations')
.select('id')
.eq('id', location_id)
.single()
if (locationError || !location) {
return NextResponse.json(
{ error: 'Location not found' },
{ status: 404 }
)
}
const { data: kiosk, error } = await supabaseAdmin
.from('kiosks')
.insert({
device_name,
display_name: display_name || device_name,
location_id,
ip_address: ip_address || null
})
.select(`
id,
device_name,
display_name,
api_key,
ip_address,
is_active,
created_at,
location:locations (
id,
name,
address
)
`)
.single()
if (error) {
console.error('Error creating kiosk:', error)
return NextResponse.json(
{ error: error.message },
{ status: 500 }
)
}
return NextResponse.json({
success: true,
kiosk
}, { status: 201 })
} catch (error) {
console.error('Kiosks POST error:', error)
return NextResponse.json(
{ error: 'Internal server error' },
{ status: 500 }
)
}
}