adjust bulk creation

This commit is contained in:
Alireza Ahmadi
2025-01-05 21:52:14 +01:00
parent a6dc0cc589
commit d86adedd8b
10 changed files with 47 additions and 14 deletions
+18
View File
@@ -48,6 +48,24 @@ func (s *ClientService) Save(tx *gorm.DB, act string, data json.RawMessage, host
if err != nil {
return nil, err
}
case "addbulk":
var clients []*model.Client
err = json.Unmarshal(data, &clients)
if err != nil {
return nil, err
}
err = json.Unmarshal(clients[0].Inbounds, &inboundIds)
if err != nil {
return nil, err
}
err = s.updateLinksWithFixedInbounds(tx, clients, inboundIds, hostname)
if err != nil {
return nil, err
}
err = tx.Save(clients).Error
if err != nil {
return nil, err
}
case "del":
var id uint
err = json.Unmarshal(data, &id)