Restructure route organization

This commit is contained in:
NeilClack
2026-05-03 20:59:43 -05:00
parent e563a66dc7
commit 3d1d713308
15 changed files with 0 additions and 0 deletions
@@ -0,0 +1,26 @@
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 };
};