From 57899b0160385c53df4e43ef2fd12492e0dffb77 Mon Sep 17 00:00:00 2001 From: Sebastien Castiel Date: Wed, 6 Dec 2023 20:21:26 -0500 Subject: Reimbursements --- src/lib/api.ts | 2 ++ src/lib/balances.ts | 1 - src/lib/schemas.ts | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/api.ts b/src/lib/api.ts index 4fd4c39..4ae88ef 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -53,6 +53,7 @@ export async function createExpense( })), }, }, + isReimbursement: expenseFormValues.isReimbursement, }, }) } @@ -105,6 +106,7 @@ export async function updateExpense( ), ), }, + isReimbursement: expenseFormValues.isReimbursement, }, }) } diff --git a/src/lib/balances.ts b/src/lib/balances.ts index 54dea00..a53bd01 100644 --- a/src/lib/balances.ts +++ b/src/lib/balances.ts @@ -54,7 +54,6 @@ export function getSuggestedReimbursements( ([participantId, { total }]) => ({ participantId, total }), ) balancesArray.sort((b1, b2) => b2.total - b1.total) - console.log(balancesArray) const reimbursements: Reimbursement[] = [] while (balancesArray.length > 1) { const first = balancesArray[0] diff --git a/src/lib/schemas.ts b/src/lib/schemas.ts index 6f0c15c..5c3489b 100644 --- a/src/lib/schemas.ts +++ b/src/lib/schemas.ts @@ -49,6 +49,7 @@ export const expenseFormSchema = z.object({ paidFor: z .array(z.string()) .min(1, 'The expense must be paid for at least 1 participant.'), + isReimbursement: z.boolean(), }) export type ExpenseFormValues = z.infer -- cgit v1.3