Reimbursements

This commit is contained in:
Sebastien Castiel
2023-12-06 20:21:26 -05:00
parent 6ce2329f5c
commit 57899b0160
9 changed files with 62 additions and 14 deletions

View File

@@ -53,6 +53,7 @@ export async function createExpense(
})),
},
},
isReimbursement: expenseFormValues.isReimbursement,
},
})
}
@@ -105,6 +106,7 @@ export async function updateExpense(
),
),
},
isReimbursement: expenseFormValues.isReimbursement,
},
})
}

View File

@@ -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]

View File

@@ -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<typeof expenseFormSchema>