MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / UpdateAlert

Method UpdateAlert

agent/app/service/alert.go:182–205  ·  view source on GitHub ↗
(req dto.AlertUpdate, operator string)

Source from the content-addressed store, hash-verified

180}
181
182func (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
207func (a AlertService) DeleteAlert(id uint) error {
208 alertInfo, _ := alertRepo.Get(repo.WithByID(id))

Callers 1

CreateAlertMethod · 0.95

Calls 5

NewIAlertTaskHelperFunction · 0.85
UpdateMethod · 0.65
WithByIDMethod · 0.65
InitTaskMethod · 0.65

Tested by

no test coverage detected