Files
splitt-the-bill/server/api/pots/[slug].get.ts
T
anbraten cbe1b42f6e
tinyedge/deploy Deployed by TinyEdge
🐛 add env to useDb and apply prettier
2026-08-07 13:28:26 +02:00

16 lines
485 B
TypeScript

import { calculateBalances } from '~~/shared/utils/balances';
export default defineEventHandler(async (event) => {
const slug = getRouterParam(event, 'slug')!;
const pot = await getPotOrThrow(slug);
const participants = await getParticipants(slug);
const expenses = await getExpensesWithParticipants(slug);
const { netBalances, settlements } = calculateBalances(
participants,
expenses,
);
return { pot, participants, expenses, netBalances, settlements };
});