diff --git a/pkg/internal/services/accounts.go b/pkg/internal/services/accounts.go index c1f82eb..580da38 100644 --- a/pkg/internal/services/accounts.go +++ b/pkg/internal/services/accounts.go @@ -2,10 +2,11 @@ package services import ( "fmt" + "time" + "github.com/rs/zerolog/log" "github.com/spf13/viper" "gorm.io/datatypes" - "time" "git.solsynth.dev/hydrogen/passport/pkg/internal/database" "git.solsynth.dev/hydrogen/passport/pkg/internal/models" @@ -207,7 +208,6 @@ func DeleteAccount(id uint) error { &models.AuthTicket{}, &models.MagicToken{}, &models.ThirdClient{}, - &models.Notification{}, &models.NotificationSubscriber{}, &models.AccountFriendship{}, } { @@ -217,6 +217,11 @@ func DeleteAccount(id uint) error { } } + if err := tx.Delete(&models.Notification{}, "recipient_id = ?", id).Error; err != nil { + tx.Rollback() + return err + } + if err := tx.Delete(&models.Account{}, "id = ?", id).Error; err != nil { tx.Rollback() return err