Skip to content

Commit

Permalink
[bugfix] fix get all tokens (#2841)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsmethurst authored Apr 16, 2024
1 parent 3cceed1 commit 6de5717
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/db/bundb/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (a *applicationDB) GetAllTokens(ctx context.Context) ([]*gtsmodel.Token, er
// Perform database query scanning
// the remaining (uncached) token IDs.
if err := a.db.NewSelect().
Model(tokens).
Model(&tokens).
Where("? IN (?)", bun.Ident("id"), bun.In(uncached)).
Scan(ctx); err != nil {
return nil, err
Expand Down
8 changes: 8 additions & 0 deletions internal/db/bundb/application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@ func (suite *ApplicationTestSuite) TestDeleteApplicationBy() {
}
}

func (suite *ApplicationTestSuite) TestGetAllTokens() {
tokens, err := suite.db.GetAllTokens(context.Background())
if err != nil {
suite.FailNow(err.Error())
}
suite.NotEmpty(tokens)
}

func TestApplicationTestSuite(t *testing.T) {
suite.Run(t, new(ApplicationTestSuite))
}

0 comments on commit 6de5717

Please sign in to comment.