From 1246f5bba99a6da2ad75126b71ae81018f030ec3 Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Wed, 30 Sep 2020 08:50:10 -0600 Subject: [PATCH] started working on notifications. --- webapp/backend/pkg/models/db/smart.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/webapp/backend/pkg/models/db/smart.go b/webapp/backend/pkg/models/db/smart.go index 889b6d1..7e11a45 100644 --- a/webapp/backend/pkg/models/db/smart.go +++ b/webapp/backend/pkg/models/db/smart.go @@ -10,6 +10,9 @@ import ( const SmartWhenFailedFailingNow = "FAILING_NOW" const SmartWhenFailedInThePast = "IN_THE_PAST" +const SmartStatusPassed = "passed" +const SmartStatusFailed = "failed" + type Smart struct { gorm.Model @@ -17,7 +20,7 @@ type Smart struct { Device Device `json:"-" gorm:"foreignkey:DeviceWWN"` // use DeviceWWN as foreign key TestDate time.Time `json:"date"` - SmartStatus string `json:"smart_status"` + SmartStatus string `json:"smart_status"` // SmartStatusPassed or SmartStatusFailed //Metrics Temp int64 `json:"temp"` @@ -49,9 +52,9 @@ func (sm *Smart) FromCollectorSmartInfo(wwn string, info collector.SmartInfo) er } if info.SmartStatus.Passed { - sm.SmartStatus = "passed" + sm.SmartStatus = SmartStatusPassed } else { - sm.SmartStatus = "failed" + sm.SmartStatus = SmartStatusFailed } return nil }