Skip to content

Commit

Permalink
Add new alert queries and mutations (#8795)
Browse files Browse the repository at this point in the history
## Summary
Add the following graphql queries and mutations:
- `createAlert` - create an alert with params
- `updateAlert` - update an alert with provided params
- `updateAlertDisabled` - update the disabled field of the alert
- `deleteAlert` - delete alert and destinations
- `alerts` - fetch alerts by project
- `alert` - fetch alert by id
- `alert_state_changes` - fetch state changes of an alert by alert id

TODOs will be addressed in the following cards:
- [Add destination
creation](https://linear.app/highlight/issue/HIG-4746/allow-adding-of-destinations)
- [Send destination
messages](https://linear.app/highlight/issue/HIG-4747/send-destinations-message-when-destination-is-createddeleted)
- [Fetch alert state
changes](https://linear.app/highlight/issue/HIG-4749/add-alert-state-changes-to-alert-detail-page)


https://www.loom.com/share/f97ff4bf04d940a9b21482295f16443f?sid=5ed6d278-7ef4-4f91-a077-31952385764b

## How did you test this change?
1) In postman upload the schema from
[here](https://raw.githubusercontent.com/highlight/highlight/d2c8b2ee014a6ea7992596c7df35f37e07e9c6d4/backend/private-graph/graph/schema.graphqls)
2) Test the queries and mutation above

## Are there any deployment considerations?
N/A - not used in production

## Does this work require review from our design team?
N/A
  • Loading branch information
SpennyNDaJets committed Jun 21, 2024
1 parent d044292 commit 72ff0e1
Show file tree
Hide file tree
Showing 6 changed files with 3,989 additions and 801 deletions.
6 changes: 4 additions & 2 deletions backend/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -1959,13 +1959,15 @@ func (s *Session) GetUserProperties() (map[string]string, error) {

type Alert struct {
Model
ProjectID int
Name string
ProductType modelInputs.ProductType
FunctionType modelInputs.MetricAggregator
Query *string
GroupByKey *string
Disabled bool `gorm:"default:false"`
LastAdminToEditID int `gorm:"last_admin_to_edit_id"`
Disabled bool `gorm:"default:false"`
LastAdminToEditID int `gorm:"last_admin_to_edit_id"`
Destinations []*AlertDestination `gorm:"foreignKey:AlertID"`

// fields for threshold alert
BelowThreshold *bool
Expand Down
Loading

0 comments on commit 72ff0e1

Please sign in to comment.