Working well enough
This commit is contained in:
@ -96,12 +96,14 @@ export async function getBudgetTransactions(id) {
|
||||
from budget_transaction
|
||||
join transaction on budget_transaction.transaction_id = transaction.id
|
||||
where budget_transaction.budget_id = ${id}
|
||||
order by transaction.posted desc
|
||||
order by transaction.date desc
|
||||
`;
|
||||
console.log(`Fetched ${transactions.length} transactions for budget ${id}`);
|
||||
// transactions = Result [{ id: 1, posted: 1633036800, amount: 50.00, description: "Grocery Store", pending: false, notes: "Weekly groceries" }, ...]
|
||||
return { transactions };
|
||||
} catch {
|
||||
} catch (error) {
|
||||
console.error(`Error fetching transactions for budget ${id}`);
|
||||
console.error(error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@ -109,9 +111,9 @@ export async function getBudgetTransactions(id) {
|
||||
export async function updateBudgetTransaction(id, amount, notes) {
|
||||
// Delete a transaction from a budget
|
||||
const result = await db`
|
||||
update from budget_transaction
|
||||
where id= ${id}
|
||||
update budget_transaction
|
||||
SET amount = ${amount}, notes = ${notes}
|
||||
where id= ${id}
|
||||
`;
|
||||
// result = Result [{ id: 1 }]
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user