Skip to content

Commit 7416a9a

Browse files
fix[backend](alerts/mcp): fixed wrong status options on change status operaion
1 parent a6ed885 commit 7416a9a

2 files changed

Lines changed: 4 additions & 11 deletions

File tree

backend/modules/alerts/usecase/alert.go

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,13 @@ func (u *alertUsecase) UpdateStatus(ctx context.Context, userLogin string, req d
5353
oldAlerts, _ = u.repo.SearchByIDs(ctx, req.AlertIDs)
5454
}
5555

56+
if err := u.repo.UpdateStatus(ctx, req.AlertIDs, req.Status, label, req.StatusObservation); err != nil {
57+
return err
58+
}
5659
if req.Status == int(domain.AlertStatusCompleted) && req.AddFalsePositiveTag {
57-
if err := u.repo.UpdateStatus(ctx, req.AlertIDs, req.Status, label, req.StatusObservation); err != nil {
58-
return err
59-
}
6060
if err := u.repo.UpdateStatusAndTag(ctx, req.AlertIDs); err != nil {
6161
return err
6262
}
63-
if err := u.repo.UpdateStatus(ctx, req.AlertIDs, req.Status, label, req.StatusObservation); err != nil {
64-
return err
65-
}
66-
} else {
67-
if err := u.repo.UpdateStatus(ctx, req.AlertIDs, req.Status, label, req.StatusObservation); err != nil {
68-
return err
69-
}
7063
}
7164

7265
if u.history != nil {

backend/modules/mcp/tools_alerts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func registerAlerts(m *Module) {
2929

3030
type alertsUpdateStatusInput struct {
3131
AlertIDs []string `json:"alert_ids" jsonschema:"OpenSearch _id values of the alerts to update"`
32-
Status int `json:"status" jsonschema:"Target status code (UTMStack convention: 0=open 1=in-review 2=closed)"`
32+
Status int `json:"status" jsonschema:"Target status code (UTMStack convention: 1=automatic-review, 2=open, 3=in-review, 5=completed/closed)"`
3333
StatusObservation string `json:"status_observation,omitempty" jsonschema:"Optional analyst note attached to the status change"`
3434
AddFalsePositiveTag bool `json:"add_false_positive_tag,omitempty" jsonschema:"If true, also apply the FALSE_POSITIVE tag (used when closing as FP)"`
3535
}

0 commit comments

Comments
 (0)