Skip to content

Commit 20e8fc2

Browse files
committed
added operator to monitor incident response
1 parent c28ce03 commit 20e8fc2

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

internal/incident/repository.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,14 @@ type IncidentAndAssertion struct {
6868
entities.Incident
6969
Property string `gorm:"column:property"`
7070
Target string `gorm:"column:target"`
71+
Operator string `gorm:"column:operator"`
7172
}
7273

7374
func (r *RepositoryImpl) GetByMonitorIDWithAssertionPaginated(ctx context.Context, monitorID uint, offset, limit *int) (*[]IncidentAndAssertion, error) {
7475
var incidents []IncidentAndAssertion
7576
if err := r.db.WithContext(
7677
ctx,
77-
).Select("incidents.*, ma.property as property, ma.target as target").Where(entities.Incident{
78+
).Select("incidents.*, ma.property as property, ma.target as target, ma.operator as operator").Where(entities.Incident{
7879
MonitorID: monitorID,
7980
}).Where(
8081
"resolved = ?", false,

internal/rest/controllers/incidents/incidents.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ type GetMonitorIncidentsResponseIncident struct {
158158
UpdatedAt string `json:"updatedAt"`
159159
Property string `json:"property"`
160160
Target string `json:"target"`
161+
Operator string `json:"operator"`
161162
}
162163

163164
func (h *Handlers) GetMonitorIncidents(c hs.AuthenticatedContext) error {
@@ -202,6 +203,7 @@ func (h *Handlers) GetMonitorIncidentsResponse(incidents *[]incident.IncidentAnd
202203
UpdatedAt: in.UpdatedAt.Format("2006-01-02T15:04:05Z07:00"),
203204
Property: in.Property,
204205
Target: in.Target,
206+
Operator: in.Operator,
205207
}
206208
}
207209

0 commit comments

Comments
 (0)