import type { PageServerLoad } from './$types'; import { error } from '@sveltejs/kit'; import { prisma } from '$lib/db'; import { canAccessAdmin } from '$lib/svelte-admin/roles'; export const load: PageServerLoad = async ({ params, parent }) => { const parentData = typeof parent === 'function' ? await parent() : {}; const userRoleId = (parentData as { userRoleId?: number }).userRoleId ?? null; if (userRoleId != null && !canAccessAdmin(userRoleId)) { throw error(403, 'not authorized'); } const proclamation = await prisma.proclamation.findUnique({ where: { id: params.id }, include: { solfeggioFrequency: true, category: { include: { parent: true } } } }); if (!proclamation) { throw error(404, 'Proclamation not found'); } return { proclamation }; };