(req dto.AlertConfigUpdate)
| 542 | } |
| 543 | |
| 544 | func (a AlertService) checkAlertConfigSMSPhoneUnique(req dto.AlertConfigUpdate) error { |
| 545 | if req.Type != constant.SMSConfig { |
| 546 | return nil |
| 547 | } |
| 548 | |
| 549 | phone := alertConfigSMSPhone(req.Config) |
| 550 | configs, err := alertRepo.AlertConfigList(alertRepo.WithByType(req.Type)) |
| 551 | if err != nil { |
| 552 | return err |
| 553 | } |
| 554 | |
| 555 | for _, config := range configs { |
| 556 | if req.ID != 0 && config.ID == req.ID { |
| 557 | continue |
| 558 | } |
| 559 | if alertConfigSMSPhone(config.Config) == phone { |
| 560 | return buserr.New("ErrAlertConfigPhoneExist") |
| 561 | } |
| 562 | } |
| 563 | |
| 564 | return nil |
| 565 | } |
| 566 | |
| 567 | func (a AlertService) checkAlertConfigDisplayNameUnique(req dto.AlertConfigUpdate) error { |
| 568 | displayName := alertConfigDisplayName(req.Type, req.Config) |
no test coverage detected