import { getSupabaseAdmin } from '@/lib/supabase/admin'; import { RESERVED_SUBDOMAINS } from '@/lib/validation'; /** * Returns true if the subdomain is reserved in EITHER the hardcoded fallback * set or the reserved_subdomains DB table. */ export async function isSubdomainReserved(subdomain: string): Promise { if (RESERVED_SUBDOMAINS.has(subdomain)) return true; const admin = getSupabaseAdmin(); const { data } = await admin .from('reserved_subdomains') .select('name') .eq('name', subdomain) .maybeSingle<{ name: string }>(); return !!data; }