From a23d165caa3ba4832c9d37a0b833b9b58df60732 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Thu, 29 Jun 2023 07:04:24 -0400 Subject: [PATCH] fix(auth): eager load the account relation to return it --- service/auth/auth.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/auth/auth.go b/service/auth/auth.go index 2b178cb..a039496 100644 --- a/service/auth/auth.go +++ b/service/auth/auth.go @@ -249,7 +249,7 @@ func VerifyLoginToken(token string) (*model.Account, error) { } session := model.LoginSession{} - if err := db.Get().Model(session).Where("token = ?", token).First(&session).Error; err != nil { + if err := db.Get().Model(session).Preload("Account").Where("token = ?", token).First(&session).Error; err != nil { logger.Get().Debug(ErrInvalidToken.Error(), zap.Error(err), zap.String("token", token)) return nil, ErrInvalidToken }