refactor(account): pass request context into services

This commit is contained in:
Leon
2025-12-09 16:05:10 +08:00
parent 4bedf58a03
commit 6804b71fe9
4 changed files with 42 additions and 39 deletions

View File

@@ -35,7 +35,7 @@ func JWTAuth(accountRepo *account.AccountRepository) gin.HandlerFunc {
return
}
accountInfo, err := accountRepo.FindByID(claims.AccountID)
accountInfo, err := accountRepo.FindByID(c.Request.Context(), claims.AccountID)
if err != nil || accountInfo.Token == "" || accountInfo.Token != tokenString {
c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{"error": "token has been revoked"})
return