move tabs into own pages
tinyedge/deploy Deployed by TinyEdge

This commit is contained in:
2026-08-07 15:49:43 +02:00
parent cbe1b42f6e
commit 99a9f908f1
13 changed files with 321 additions and 325 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ import type { H3Event } from 'h3';
let instance: ReturnType<typeof drizzle<typeof schema>> | undefined;
export function useDb(event: H3Event) {
export function useDb(event?: H3Event) {
if (!instance) {
const config = useRuntimeConfig(event);
const client = createClient({
+1 -1
View File
@@ -2,7 +2,7 @@ import { migrate } from 'drizzle-orm/libsql/migrator';
import { useDb } from '../database/client';
export default defineNitroPlugin(async () => {
await migrate(useDb(event), {
await migrate(useDb(), {
migrationsFolder: 'server/database/migrations',
});
});
+3 -3
View File
@@ -18,7 +18,7 @@ export interface ExpenseWithDetails {
}
export async function getPotOrThrow(slug: string) {
const db = useDb(event);
const db = useDb();
const [pot] = await db.select().from(pots).where(eq(pots.slug, slug));
if (!pot) {
throw createError({ statusCode: 404, statusMessage: 'Pot not found' });
@@ -27,14 +27,14 @@ export async function getPotOrThrow(slug: string) {
}
export async function getParticipants(slug: string) {
const db = useDb(event);
const db = useDb();
return db.select().from(participants).where(eq(participants.potSlug, slug));
}
export async function getExpensesWithParticipants(
slug: string,
): Promise<ExpenseWithDetails[]> {
const db = useDb(event);
const db = useDb();
const expenseRows = await db
.select()
.from(expenses)