data browser wip
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user