From 6de5717d7f8666c8a47cbdd6d9fd3b292be6fce4 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Tue, 16 Apr 2024 13:25:47 +0200 Subject: [PATCH] [bugfix] fix get all tokens (#2841) --- internal/db/bundb/application.go | 2 +- internal/db/bundb/application_test.go | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/internal/db/bundb/application.go b/internal/db/bundb/application.go index c2a957c93..00f5e0622 100644 --- a/internal/db/bundb/application.go +++ b/internal/db/bundb/application.go @@ -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 diff --git a/internal/db/bundb/application_test.go b/internal/db/bundb/application_test.go index d2ab05ebd..d03079f2a 100644 --- a/internal/db/bundb/application_test.go +++ b/internal/db/bundb/application_test.go @@ -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)) }