@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user