refactor(model): Refactor Status model

This commit is contained in:
2025-08-10 22:19:53 +03:00
parent 23874ef975
commit 57c8c86c3a

View File

@@ -6,18 +6,20 @@ import (
"gorm.io/gorm"
)
type StatusCode string
const (
StatusOK = "ok" // Means - response ok, service is alive
StatusFailed = "failed" // Means - response failed, all tries failed, service down
StatusWarn = "warn" // Means - response failed after N tries and still watched
StatusOK StatusCode = "ok" // Means - response ok, service is alive
StatusFailed StatusCode = "failed" // Means - response failed, all tries failed, service down
StatusWarn StatusCode = "warn" // Means - response failed after N tries and still watched
)
type Status struct {
ID int `gorm:"primary_key;auto_increment" json:"-"`
ServiceID int `gorm:"one" json:"-"`
Status string `gorm:"size:255;not null" json:"status"`
Description *string `gorm:"size:255" json:"description"`
CreatedAt time.Time `json:"created_at"`
ID int `gorm:"primary_key;auto_increment" json:"-"`
ServiceID int `gorm:"one" json:"-"`
Status StatusCode `gorm:"size:255;not null" json:"status"`
Description *string `gorm:"size:255" json:"description"`
CreatedAt time.Time `json:"created_at"`
}
func (Status) TableName() string {