🐛 Fix check delete account issue

This commit is contained in:
LittleSheep 2024-09-25 20:18:11 +08:00
parent cec234bc53
commit cb3cc3f540

View File

@ -3,11 +3,12 @@ package services
import (
"context"
"fmt"
"git.solsynth.dev/hydrogen/dealer/pkg/proto"
"git.solsynth.dev/hydrogen/passport/pkg/internal/gap"
"time"
"unicode"
"git.solsynth.dev/hydrogen/dealer/pkg/proto"
"git.solsynth.dev/hydrogen/passport/pkg/internal/gap"
"gorm.io/gorm/clause"
"github.com/rs/zerolog/log"
@ -191,7 +192,7 @@ func CheckAbleToDeleteAccount(user models.Account) error {
if err := database.C.
Where("account_id = ?", user.ID).
Where("expired_at < ?", time.Now()).
Where("type = ?", models.ResetPasswordMagicToken).
Where("type = ?", models.DeleteAccountMagicToken).
Model(&models.MagicToken{}).
Count(&count).Error; err != nil {
return fmt.Errorf("unable to check delete account ability: %v", err)