(alertRepo repo.IAlertRepo, alert dto.AlertDTO, pushAlert dto.PushAlert, method string)
| 49 | } |
| 50 | |
| 51 | func pushByLegacyMethod(alertRepo repo.IAlertRepo, alert dto.AlertDTO, pushAlert dto.PushAlert, method string) { |
| 52 | typeMap := map[string]string{ |
| 53 | "mail": constant.Email, |
| 54 | constant.Bark: constant.Bark, |
| 55 | constant.SMS: constant.SMS, |
| 56 | } |
| 57 | configType := method |
| 58 | if mapped, ok := typeMap[method]; ok { |
| 59 | configType = mapped |
| 60 | } |
| 61 | config, err := alertRepo.GetConfig(alertRepo.WithByType(configType)) |
| 62 | if err != nil { |
| 63 | global.LOG.Errorf("alert config not found for type %s: %v", configType, err) |
| 64 | return |
| 65 | } |
| 66 | sendAlert(alertRepo, alert, pushAlert, config) |
| 67 | } |
| 68 | |
| 69 | func sendAlert(alertRepo repo.IAlertRepo, alert dto.AlertDTO, pushAlert dto.PushAlert, config model.AlertConfig) { |
| 70 | if !alertUtil.IsAlertConfigEnabled(config) { |
no test coverage detected