fixed showing transactions for all users

This commit is contained in:
Fran Jurmanović
2021-06-13 21:34:19 +02:00
parent 5b53610b61
commit 9068f5bdcb
2 changed files with 7 additions and 3 deletions

View File

@@ -32,10 +32,10 @@ func (as *TransactionService) New(body *models.NewTransactionBody) *models.Trans
return tm
}
func (as *TransactionService) GetAll(walletId string, filtered *models.FilteredResponse) {
func (as *TransactionService) GetAll(am *models.Auth, walletId string, filtered *models.FilteredResponse) {
wm := new([]models.Transaction)
query := as.Db.Model((wm))
query := as.Db.Model((wm)).Relation("Wallet").Where("wallet.? = ?", pg.Ident("user_id"), am.Id)
if walletId != "" {
query = query.Where("? = ?", pg.Ident("wallet_id"), walletId)
}