Display category in accounts view
This commit is contained in:
parent
495bc2b7c3
commit
e2d22a1080
@ -16,10 +16,12 @@ LIMIT 200;
|
||||
|
||||
-- name: GetTransactionsForAccount :many
|
||||
SELECT transactions.id, transactions.date, transactions.memo, transactions.amount,
|
||||
accounts.name as account, payees.name as payee
|
||||
accounts.name as account, payees.name as payee, category_groups.name as category_group, categories.name as category
|
||||
FROM transactions
|
||||
INNER JOIN accounts ON accounts.id = transactions.account_id
|
||||
INNER JOIN payees ON payees.id = transactions.payee_id
|
||||
INNER JOIN categories ON categories.id = transactions.category_id
|
||||
INNER JOIN category_groups ON category_groups.id = categories.category_group_id
|
||||
WHERE transactions.account_id = $1
|
||||
ORDER BY transactions.date DESC
|
||||
LIMIT 200;
|
@ -50,22 +50,26 @@ func (q *Queries) CreateTransaction(ctx context.Context, arg CreateTransactionPa
|
||||
|
||||
const getTransactionsForAccount = `-- name: GetTransactionsForAccount :many
|
||||
SELECT transactions.id, transactions.date, transactions.memo, transactions.amount,
|
||||
accounts.name as account, payees.name as payee
|
||||
accounts.name as account, payees.name as payee, category_groups.name as category_group, categories.name as category
|
||||
FROM transactions
|
||||
INNER JOIN accounts ON accounts.id = transactions.account_id
|
||||
INNER JOIN payees ON payees.id = transactions.payee_id
|
||||
INNER JOIN categories ON categories.id = transactions.category_id
|
||||
INNER JOIN category_groups ON category_groups.id = categories.category_group_id
|
||||
WHERE transactions.account_id = $1
|
||||
ORDER BY transactions.date DESC
|
||||
LIMIT 200
|
||||
`
|
||||
|
||||
type GetTransactionsForAccountRow struct {
|
||||
ID uuid.UUID
|
||||
Date time.Time
|
||||
Memo string
|
||||
Amount Numeric
|
||||
Account string
|
||||
Payee string
|
||||
ID uuid.UUID
|
||||
Date time.Time
|
||||
Memo string
|
||||
Amount Numeric
|
||||
Account string
|
||||
Payee string
|
||||
CategoryGroup string
|
||||
Category string
|
||||
}
|
||||
|
||||
func (q *Queries) GetTransactionsForAccount(ctx context.Context, accountID uuid.UUID) ([]GetTransactionsForAccountRow, error) {
|
||||
@ -84,6 +88,8 @@ func (q *Queries) GetTransactionsForAccount(ctx context.Context, accountID uuid.
|
||||
&i.Amount,
|
||||
&i.Account,
|
||||
&i.Payee,
|
||||
&i.CategoryGroup,
|
||||
&i.Category,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -21,6 +21,9 @@
|
||||
<td>
|
||||
{{.Payee}}
|
||||
</td>
|
||||
<td>
|
||||
{{.Category}}
|
||||
</td>
|
||||
<td>
|
||||
<a href="transaction/{{.ID}}">{{.Memo}}</a>
|
||||
</td>
|
||||
|
Loading…
x
Reference in New Issue
Block a user