Files
Maintainarr/internal/models/models.go

166 lines
3.5 KiB
Go

package models
import "time"
type Role string
const (
RoleAdmin Role = "admin"
RoleEditor Role = "editor"
RoleViewer Role = "viewer"
)
type Organization struct {
ID int64
Name string
Theme string
ThemeMode string
CreatedAt time.Time
}
type User struct {
ID int64
Organization int64
Name string
Email string
PasswordHash string
Role Role
OTPSecret string
OTPEnabled bool
ThemeMode string
CreatedAt time.Time
}
type VMGroup struct {
ID int64
OrganizationID int64
Name string
Description string
ColorToken string
CreatedAt time.Time
}
type Node struct {
ID int64
OrganizationID int64
GroupID *int64
GroupName string
Tag string
Name string
Distro string
Hostname string
IPAddress string
MACAddress string
SSHPort int
SSHUsername string
SSHPassword string
PackageManager string
Architecture string
HostModel string
KernelVersion string
CPUModel string
GPUModel string
DefaultShell string
PackageCount int64
MemoryTotalMB int64
DiskTotalGB int64
CPUUsage float64
RAMUsage float64
DiskUsage float64
UptimeSeconds int64
LastSeenAt *time.Time
AutoUpdatesEnabled bool
Notes string
CreatedAt time.Time
UpdatedAt time.Time
}
type AutomationJob struct {
ID int64
OrganizationID int64
NodeID *int64
GroupID *int64
NodeName string
GroupName string
Tag string
Name string
TriggerType string
Schedule string
Command string
Enabled bool
LastRunAt *time.Time
NextRunAt *time.Time
CreatedAt time.Time
}
type CommandRun struct {
ID int64
JobID *int64
NodeID int64
JobName string
NodeName string
GroupName string
Action string
CommandText string
Status string
Output string
TriggeredBy *int64
StartedAt time.Time
FinishedAt *time.Time
DurationText string
}
type UptimeMonitor struct {
ID int64
OrganizationID int64
NodeID int64
NodeName string
GroupName string
Name string
Target string
MonitorType string
IntervalSeconds int64
Enabled bool
LastStatus string
LastLatencyMS int64
LastCheckedAt *time.Time
LastError string
UpSinceAt *time.Time
CurrentOutageStartedAt *time.Time
CreatedAt time.Time
UpdatedAt time.Time
}
type UptimeCheck struct {
ID int64
MonitorID int64
Status string
LatencyMS int64
ErrorMessage string
CheckedAt time.Time
}
type UptimeIncident struct {
ID int64
MonitorID int64
MonitorName string
NodeName string
GroupName string
ErrorMessage string
StartedAt time.Time
EndedAt *time.Time
DurationSeconds int64
DurationText string
}
type UptimePeriodSummary struct {
TotalChecks int64
UpChecks int64
DownChecks int64
AvgLatencyMS int64
DowntimeSeconds int64
IncidentCount int64
LongestIncidentSeconds int64
AvgIncidentSeconds int64
}