Prevent removing participants with expenses

This commit is contained in:
Sebastien Castiel
2023-12-07 20:12:40 -05:00
parent fb6cff2fe3
commit 6f077f141e
6 changed files with 129 additions and 13 deletions

View File

@@ -66,6 +66,18 @@ export async function deleteExpense(expenseId: string) {
})
}
export async function getGroupExpensesParticipants(groupId: string) {
const expenses = await getGroupExpenses(groupId)
return Array.from(
new Set(
expenses.flatMap((e) => [
e.paidById,
...e.paidFor.map((pf) => pf.participantId),
]),
),
)
}
export async function updateExpense(
groupId: string,
expenseId: string,