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