refactor: Fix linter errors by auto-apply

- Apply automated linter fixes
- Manually reformat fields in model/service.go
- Resolve code complexity issues
This commit is contained in:
2025-11-04 19:59:17 +03:00
parent 180a5c2a90
commit fc8b723114
11 changed files with 60 additions and 32 deletions

View File

@@ -7,33 +7,34 @@ type HTTPConfig struct {
Headers map[string]string `json:"headers"`
}
// ServiceTypeCheckConfig
// MaxFails - max "ping" fails, after with the service marked as unavailable
// Interval - interval between "ping" in seconds
// Timeout - interval after which the task will be canceled
type ServiceTypeCheckConfig struct {
Version string `json:"version"`
HTTPConfig *HTTPConfig `json:"httpConfig"`
// MaxFails - max "ping" fails, after with the service marked as unavailable
MaxFails uint8 `json:"maxFails"`
// Interval - interval between "ping" in seconds
Interval uint64 `json:"interval"`
// Timeout - interval after which the task will be canceled
Timeout uint64 `json:"timeout"`
MaxFails uint8 `json:"maxFails"`
Interval uint64 `json:"interval"`
Timeout uint64 `json:"timeout"`
}
// Service
// ID Unique ID for entity
// Name Human-readable service name
// Description Human-readable service description
// Host to check, for example 192.168.1.44 or https://google.com
// Type for check, for now is TCP or HTTP or something else
type Service struct {
// Unique ID for entity
ID uint64 `gorm:"primary_key;auto_increment" json:"id"`
// Human-readable service name
Name string `gorm:"size:255;not null" json:"name"`
// Human-readable service description
Description string `gorm:"size:255" json:"description"`
PublicDescription string `gorm:"size:255" json:"publicDescription"`
Public *bool `gorm:"default:false" json:"public"`
// Host to check, for example 192.168.1.44 or https://google.com
Host string `gorm:"size:255;not null" json:"host"`
// Type for check, for now is TCP or HTTP or something else
Type string `gorm:"size:255;not null" json:"type"`
Config *ServiceTypeCheckConfig `gorm:"serializer:json;column:type_config" json:"typeConfig"`
Statuses []Status `gorm:"foreignkey:ServiceID" json:"statuses"`
ID uint64 `gorm:"primary_key;auto_increment" json:"id"`
Name string `gorm:"size:255;not null" json:"name"`
Description string `gorm:"size:255" json:"description"`
PublicDescription string `gorm:"size:255" json:"publicDescription"`
Public *bool `gorm:"default:false" json:"public"`
Host string `gorm:"size:255;not null" json:"host"`
Type string `gorm:"size:255;not null" json:"type"`
Config *ServiceTypeCheckConfig `gorm:"serializer:json;column:type_config" json:"typeConfig"`
Statuses []Status `gorm:"foreignkey:ServiceID" json:"statuses"`
}
func (Service) TableName() string {