Implement update and delete for transactions

This commit is contained in:
2021-12-27 23:38:30 +00:00
parent ab43387f06
commit 6bac09a38e
5 changed files with 120 additions and 19 deletions

View File

@ -8,6 +8,20 @@ INSERT INTO transactions
VALUES ($1, $2, $3, $4, $5, $6)
RETURNING *;
-- name: UpdateTransaction :exec
UPDATE transactions
SET date = $1,
memo = $2,
amount = $3,
account_id = $4,
payee_id = $5,
category_id = $6
WHERE id = $7;
-- name: DeleteTransaction :exec
DELETE FROM transactions
WHERE id = $1;
-- name: GetTransactionsForBudget :many
SELECT transactions.id, transactions.date, transactions.memo, transactions.amount,
accounts.name as account, COALESCE(payees.name, '') as payee, COALESCE(category_groups.name, '') as category_group, COALESCE(categories.name, '') as category