data browser wip

This commit is contained in:
2026-10-24 02:42:31 +00:00
parent c8205e474e
commit 941a9f16e1
22 changed files with 2141 additions and 6 deletions

View File

@@ -2,10 +2,21 @@ import { requireAdmin } from '#lib/server/authorization.js';
import { uniqueListSlug } from '#lib/server/slugify.js';
import { listImageUrl } from '#lib/server/r2.js';
import { createList, listSummaries } from '#lib/server/lists.js';
import { listTables, type TableSummary } from '#lib/server/data-editor.js';
import { isOwner } from '#lib/server/owner.js';
import { fail, redirect } from '@sveltejs/kit';
import type { Actions, PageServerLoad } from './$types';
export const load: PageServerLoad = async () => ({ lists: await listSummaries() });
export const load: PageServerLoad = async (event) => {
const owner = isOwner(event);
// The database browser (every schema/table) is only ever loaded for the owner.
const [lists, tables] = await Promise.all([
listSummaries(),
owner ? listTables() : Promise.resolve([] as TableSummary[])
]);
if (owner) event.setHeaders({ 'cache-control': 'private, no-store' });
return { lists, tables };
};
export const actions: Actions = {
newList: async (event) => {