Files
splitt-the-bill/server/api/pots/[slug].get.ts
T
anbraten 67727f96ab
tinyedge/deploy Deployed by TinyEdge
🐛 fix typecheck and cleanup imports
2026-08-07 12:57:45 +02:00

13 lines
464 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 }
})