From 0c6843873249b0aa99d3f961ac7ccd5638237d4c Mon Sep 17 00:00:00 2001 From: Jan Bader Date: Fri, 22 Apr 2022 18:33:32 +0000 Subject: [PATCH] Add budgetID param --- postgres/queries/transactions.sql | 3 ++- postgres/transactions.sql.go | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/postgres/queries/transactions.sql b/postgres/queries/transactions.sql index 3e9c9d6..545e09c 100644 --- a/postgres/queries/transactions.sql +++ b/postgres/queries/transactions.sql @@ -60,4 +60,5 @@ LEFT JOIn accounts AS otherGroupAccount ON otherGroupTransaction.account_id = accounts.id WHERE transactions.category_id IS NULL AND accounts.on_budget -AND (otherGroupAccount.id IS NULL OR NOT otherGroupAccount.on_budget); \ No newline at end of file +AND (otherGroupAccount.id IS NULL OR NOT otherGroupAccount.on_budget) +AND accounts.budget_id = $1; \ No newline at end of file diff --git a/postgres/transactions.sql.go b/postgres/transactions.sql.go index 9b720c1..067f607 100644 --- a/postgres/transactions.sql.go +++ b/postgres/transactions.sql.go @@ -132,6 +132,7 @@ LEFT JOIn accounts AS otherGroupAccount WHERE transactions.category_id IS NULL AND accounts.on_budget AND (otherGroupAccount.id IS NULL OR NOT otherGroupAccount.on_budget) +AND accounts.budget_id = $1 ` type GetProblematicTransactionsRow struct { @@ -167,8 +168,8 @@ type GetProblematicTransactionsRow struct { LastReconciled_2 sql.NullTime } -func (q *Queries) GetProblematicTransactions(ctx context.Context) ([]GetProblematicTransactionsRow, error) { - rows, err := q.db.QueryContext(ctx, getProblematicTransactions) +func (q *Queries) GetProblematicTransactions(ctx context.Context, budgetID uuid.UUID) ([]GetProblematicTransactionsRow, error) { + rows, err := q.db.QueryContext(ctx, getProblematicTransactions, budgetID) if err != nil { return nil, err }