small pattern fixes

This commit is contained in:
Fran Jurmanović
2021-06-22 17:18:48 +02:00
parent 2992d433fa
commit 830fa65f8a
4 changed files with 5 additions and 5 deletions

View File

@@ -23,13 +23,12 @@ func NewWalletsHeaderController(as *services.WalletService, s *gin.RouterGroup)
func (wc *WalletsHeaderController) Get(c *gin.Context) {
body := new(models.Auth)
embed, _ := c.GetQuery("embed")
walletId, _ := c.GetQuery("walletId")
auth := c.MustGet("auth")
body.Id = auth.(*models.Auth).Id
wm := wc.WalletService.GetHeader(body, embed, walletId)
wm := wc.WalletService.GetHeader(body, walletId)
c.JSON(200, wm)
}

View File

@@ -55,7 +55,7 @@ func CheckToken(tokenString string) (*jwt.Token, error) {
_, ok := token.Method.(*jwt.SigningMethodHMAC)
var err error
if !ok {
err = errors.New("Invalid token")
err = errors.New("invalid token")
}
return []byte(secret), err
})

View File

@@ -42,6 +42,7 @@ func (as *TransactionService) GetAll(am *models.Auth, walletId string, filtered
if walletId != "" {
query2 = query2.Where("? = ?", pg.Ident("wallet_id"), walletId)
}
query2.Select()
for _, sub := range *sm {
as.Ss.SubToTrans(&sub)

View File

@@ -40,7 +40,7 @@ func (as *WalletService) GetAll(am *models.Auth, filtered *models.FilteredRespon
FilteredResponse(query, wm, filtered)
}
func (as *WalletService) GetHeader(am *models.Auth, embed string, walletId string) *models.WalletHeader {
func (as *WalletService) GetHeader(am *models.Auth, walletId string) *models.WalletHeader {
wm := new(models.WalletHeader)
wallets := new([]models.WalletTransactions)
var wg sync.WaitGroup
@@ -117,7 +117,7 @@ func (as *WalletService) GetHeader(am *models.Auth, embed string, walletId strin
func addWhere(s *[]models.WalletTransactions, walletId string, e models.Transaction) {
var exists bool
for a, _ := range *s {
for a := range *s {
if (*s)[a].WalletId == walletId {
(*s)[a].Transactions = append((*s)[a].Transactions, e)
exists = true