prototype: isolate model status fixtures

This commit is contained in:
jb
2026-08-23 18:30:02 -04:00
parent e5213248a8
commit fe06b90117
3 changed files with 33 additions and 1 deletions
+10
View File
@@ -1,3 +1,4 @@
import { dev } from '$app/environment';
import { json, type Handle, type HandleServerError } from '@sveltejs/kit';
import { stringify } from 'devalue';
import { randomUUID } from 'node:crypto';
@@ -15,6 +16,15 @@ import {
} from '$lib/server/data-moderation';
export const handle: Handle = async ({ event, resolve }) => {
// THROWAWAY PROTOTYPE: fixture-only review must not open the shared database.
if (
dev &&
event.url.pathname === '/database' &&
event.url.searchParams.get('prototype') === 'model-status'
) {
return resolve(event);
}
if (
event.url.pathname === '/admin' ||
event.url.pathname.startsWith('/admin/')
+17 -1
View File
@@ -1,10 +1,26 @@
import { dev } from '$app/environment';
import { getSessionUser } from '$lib/server/auth/session';
import { hasPermission } from '$lib/server/auth/authorization';
import type { LayoutServerLoad } from './$types';
import { notificationSummary } from '$lib/server/notifications';
import { getSiteAccessSettings } from '$lib/server/site-access';
export const load: LayoutServerLoad = async ({ cookies }) => {
export const load: LayoutServerLoad = async ({ cookies, url }) => {
// THROWAWAY PROTOTYPE: fixture-only review must not open the shared database.
if (dev && url.pathname === '/database' && url.searchParams.get('prototype') === 'model-status') {
return {
user: null,
isacAccess: false,
notifications: { unread: 0 },
siteAccess: {
comingSoonEnabled: false,
accountCreationEnabled: true,
sections: { news: true, database: true, builds: true, guides: true, builder: true },
updatedAt: 'prototype'
}
};
}
const user = await getSessionUser(cookies);
return {
user,
+6
View File
@@ -1,3 +1,4 @@
import { dev } from '$app/environment';
import { getDatabase } from '$lib/server/database';
import { getRegistrySearch } from '$lib/server/pagination';
import { databaseCategories } from '$lib/database/categories';
@@ -16,6 +17,11 @@ const tables = {
} as const;
export const load: PageServerLoad = async ({ url }) => {
// THROWAWAY PROTOTYPE: avoid opening the shared database for fixture-only review.
if (dev && url.searchParams.get('prototype') === 'model-status') {
return { registries: [], total: 0, search: '', searchResults: [] };
}
const database = await getDatabase();
const { search, pattern } = getRegistrySearch(url);
const counts = await Promise.all(