mirror of
https://github.com/marcogll/AnchorOS.git
synced 2026-03-15 11:24:26 +00:00
feat: Implementar API de reservas para clientes
- Crear route /api/bookings con POST y GET - Validar disponibilidad de staff y recursos - Crear cliente si no existe - Generar short_id para reservas - Utilizar RPC functions de disponibilidad - Agregar utilidad generateShortId
This commit is contained in:
11
lib/utils/short-id.ts
Normal file
11
lib/utils/short-id.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { supabaseAdmin } from '@/lib/supabase/client'
|
||||
|
||||
export async function generateShortId(): Promise<string> {
|
||||
const { data, error } = await supabaseAdmin.rpc('generate_short_id')
|
||||
|
||||
if (error) {
|
||||
throw new Error(`Failed to generate short_id: ${error.message}`)
|
||||
}
|
||||
|
||||
return data as string
|
||||
}
|
||||
Reference in New Issue
Block a user