feat(backend): 支持外部邮箱启用/删除接口及用户账号级联删除接口
Security Checks / security (push) Waiting to run

This commit is contained in:
xuans committed 2026-10-17 22:28:58 +08:00
1 parent 00f3283a4a
commit 583b9e88b7
7 files changed
+190 -1

No files matched your search

@@ -411,6 +411,20 @@ func (r *Repository) AbandonPending(userID, id int) error {
return nil
}
func (r *Repository) Delete(userID, id int) error {
if r == nil || r.engine == nil || userID <= 0 || id <= 0 {
return ErrInvalidBinding
}
affected, err := r.engine.Where("id = ? AND user_id = ?", id, userID).Delete(&models.ExternalEmail{})
if err != nil {
return fmt.Errorf("delete external email binding: %w", err)
}
if affected == 0 {
return ErrBindingOwnership
}
return nil
}
func (r *Repository) Disable(userID, id int) error {
if r == nil || r.engine == nil || userID <= 0 || id <= 0 {
return ErrInvalidBinding