diff options
| author | Chris Johnston <christopher_johnston@me.com> | 2024-01-08 19:26:44 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-08 14:26:44 -0500 |
| commit | bec1dd270a1d3184ea13f0b849f192176354fc00 (patch) | |
| tree | ebb50246aad6c0562ae892d1729c4eda94ad6ffd /src/lib/api.ts | |
| parent | 4566900f9cfcc837e56c590c9344d09a4bc50820 (diff) | |
Add Expense Date (#26)
* add expense date
* Improve date formatting
* Prettier
* Change field description
---------
Co-authored-by: Sebastien Castiel <sebastien@castiel.me>
Diffstat (limited to 'src/lib/api.ts')
| -rw-r--r-- | src/lib/api.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/api.ts b/src/lib/api.ts index 586a354..6ff55b6 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -47,6 +47,7 @@ export async function createExpense( data: { id: randomId(), groupId, + expenseDate: expenseFormValues.expenseDate, amount: expenseFormValues.amount, title: expenseFormValues.title, paidById: expenseFormValues.paidBy, @@ -120,6 +121,7 @@ export async function updateExpense( return prisma.expense.update({ where: { id: expenseId }, data: { + expenseDate: expenseFormValues.expenseDate, amount: expenseFormValues.amount, title: expenseFormValues.title, paidById: expenseFormValues.paidBy, @@ -210,7 +212,7 @@ export async function getGroupExpenses(groupId: string) { return prisma.expense.findMany({ where: { groupId }, include: { paidFor: { include: { participant: true } }, paidBy: true }, - orderBy: { createdAt: 'desc' }, + orderBy: { expenseDate: 'desc' }, }) } |
