51 lines
2.2 KiB
Go
51 lines
2.2 KiB
Go
package alert_lifecycle
|
|
|
|
import "time"
|
|
|
|
const (
|
|
StatusOpen = "open"
|
|
StatusAcknowledged = "acknowledged"
|
|
StatusClosed = "closed"
|
|
)
|
|
|
|
type Projection struct {
|
|
ID string `json:"id" gorm:"type:uuid;primaryKey"`
|
|
Status string `json:"status"`
|
|
AcknowledgedBy *int `json:"acknowledgedBy,omitempty"`
|
|
AcknowledgedByName *string `json:"acknowledgedByName,omitempty"`
|
|
AcknowledgedAt *time.Time `json:"acknowledgedAt,omitempty"`
|
|
ClosedBy *int `json:"closedBy,omitempty"`
|
|
ClosedByName *string `json:"closedByName,omitempty"`
|
|
ClosedAt *time.Time `json:"closedAt,omitempty"`
|
|
CloseOutcome *string `json:"closeOutcome,omitempty"`
|
|
CloseNote *string `json:"closeNote,omitempty"`
|
|
}
|
|
|
|
func (Projection) TableName() string { return "bell_alerts" }
|
|
|
|
type Fact struct {
|
|
ID string `json:"id" gorm:"type:uuid;primaryKey"`
|
|
AlertID string `json:"alertId" gorm:"type:uuid;not null;uniqueIndex:bell_alert_transition"`
|
|
Transition string `json:"transition" gorm:"size:24;not null;uniqueIndex:bell_alert_transition"`
|
|
ActorID int `json:"actorId" gorm:"not null"`
|
|
ActorName string `json:"actorName" gorm:"size:128;not null"`
|
|
Outcome *string `json:"outcome,omitempty" gorm:"size:32"`
|
|
Note *string `json:"note,omitempty" gorm:"size:500"`
|
|
OccurredAt time.Time `json:"occurredAt" gorm:"type:timestamptz;not null;index"`
|
|
}
|
|
|
|
func (Fact) TableName() string { return "bell_alert_lifecycle_facts" }
|
|
|
|
type RejectionAudit struct {
|
|
ID string `json:"id" gorm:"type:uuid;primaryKey"`
|
|
AlertID *string `json:"alertId,omitempty" gorm:"type:uuid;index"`
|
|
Action string `json:"action" gorm:"size:16;not null"`
|
|
ActorID int `json:"actorId" gorm:"not null;index"`
|
|
Reason string `json:"reason" gorm:"size:64;not null"`
|
|
ObservedStatus *string `json:"observedStatus,omitempty" gorm:"size:24"`
|
|
ObservedActor *int `json:"observedActor,omitempty"`
|
|
CreatedAt time.Time `json:"createdAt" gorm:"type:timestamptz;not null;index"`
|
|
}
|
|
|
|
func (RejectionAudit) TableName() string { return "bell_alert_lifecycle_rejections" }
|