(req dto.AlertUpdate, operator string)
| 180 | } |
| 181 | |
| 182 | func (a AlertService) UpdateAlert(req dto.AlertUpdate, operator string) error { |
| 183 | if err := a.validateCommunityAlertMethod(req.Method); err != nil { |
| 184 | return err |
| 185 | } |
| 186 | |
| 187 | upMap := make(map[string]interface{}) |
| 188 | upMap["id"] = req.ID |
| 189 | upMap["type"] = req.Type |
| 190 | upMap["cycle"] = req.Cycle |
| 191 | upMap["count"] = req.Count |
| 192 | upMap["method"] = req.Method |
| 193 | upMap["title"] = req.Title |
| 194 | upMap["project"] = req.Project |
| 195 | upMap["status"] = req.Status |
| 196 | upMap["send_count"] = req.SendCount |
| 197 | upMap["advanced_params"] = req.AdvancedParams |
| 198 | upMap["update_user"] = operator |
| 199 | |
| 200 | if err := alertRepo.Update(upMap, repo.WithByID(req.ID)); err != nil { |
| 201 | return err |
| 202 | } |
| 203 | NewIAlertTaskHelper().InitTask(req.Type) |
| 204 | return nil |
| 205 | } |
| 206 | |
| 207 | func (a AlertService) DeleteAlert(id uint) error { |
| 208 | alertInfo, _ := alertRepo.Get(repo.WithByID(id)) |
no test coverage detected