Skip to content

Commit

Permalink
feat: add filters to notification silences
Browse files Browse the repository at this point in the history
  • Loading branch information
adityathebe committed Nov 7, 2024
1 parent 798c786 commit fabbe39
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
23 changes: 12 additions & 11 deletions models/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,18 @@ func (t NotificationSilenceResource) Empty() bool {
type NotificationSilence struct {
NotificationSilenceResource `json:",inline" yaml:",inline"`

ID uuid.UUID `json:"id" gorm:"default:generate_ulid()"`
Namespace string `json:"namespace,omitempty"`
From time.Time `json:"from"`
Until time.Time `json:"until"`
Source string `json:"source"`
Recursive bool `json:"recursive"`
Description string `json:"description,omitempty"`
CreatedBy *uuid.UUID `json:"created_by,omitempty"`
CreatedAt time.Time `json:"created_at" time_format:"postgres_timestamp" gorm:"<-:false"`
UpdatedAt time.Time `json:"updated_at" time_format:"postgres_timestamp" gorm:"<-:false"`
DeletedAt *time.Time `json:"deleted_at,omitempty"`
ID uuid.UUID `json:"id" gorm:"default:generate_ulid()"`
Namespace string `json:"namespace,omitempty"`
Filter types.CelExpression `json:"filter,omitempty"`
From time.Time `json:"from"`
Until time.Time `json:"until"`
Source string `json:"source"`
Recursive bool `json:"recursive"`
Description string `json:"description,omitempty"`
CreatedBy *uuid.UUID `json:"created_by,omitempty"`
CreatedAt time.Time `json:"created_at" time_format:"postgres_timestamp" gorm:"<-:false"`
UpdatedAt time.Time `json:"updated_at" time_format:"postgres_timestamp" gorm:"<-:false"`
DeletedAt *time.Time `json:"deleted_at,omitempty"`
}

func (n NotificationSilence) AsMap(removeFields ...string) map[string]any {
Expand Down
6 changes: 5 additions & 1 deletion schema/notifications.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ table "notification_silences" {
null = true
type = text
}
column "filter" {
null = true
type = text
}
column "from" {
null = false
type = timestamptz
Expand Down Expand Up @@ -299,4 +303,4 @@ table "notification_silences" {
on_update = NO_ACTION
on_delete = NO_ACTION
}
}
}

0 comments on commit fabbe39

Please sign in to comment.