This commit is contained in:
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
|
||||
|
||||
Reference in new issue
Block a user