mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-07-25 13:56:10 +00:00
fix(client): delete external-link rows when bulk-deleting clients
The single-client Delete path removes a client's client_external_links rows, but BulkDelete (and the DelDepleted reaper that routes through it) deleted the record, mappings and traffic while leaving the external-link rows keyed by the now-dead client id, so they accumulated as orphans. Delete them in the same cleanup transaction, keyed by client id like the single path.
This commit is contained in:
@@ -855,6 +855,9 @@ func (s *ClientService) BulkDelete(inboundSvc *InboundService, emails []string,
|
||||
if e := tx.Where("client_id IN ?", batch).Delete(&model.ClientInbound{}).Error; e != nil {
|
||||
return e
|
||||
}
|
||||
if e := tx.Where("client_id IN ?", batch).Delete(&model.ClientExternalLink{}).Error; e != nil {
|
||||
return e
|
||||
}
|
||||
}
|
||||
if !keepTraffic && len(successEmails) > 0 {
|
||||
for _, batch := range chunkStrings(successEmails, sqlInChunk) {
|
||||
|
||||
Reference in New Issue
Block a user