import { env } from '$env/dynamic/private'; export function requireAdmin(userId: string | undefined): void { if (!userId) throw new Error('Not authenticated'); const adminIds = (env.ADMIN_USER_IDS ?? '') .split(',') .map((s) => s.trim()) .filter(Boolean); if (adminIds.length === 0 || !adminIds.includes(userId)) { throw new Error('Admin access required'); } }