api with functioning managment

This commit is contained in:
Fran Jurmanović
2025-02-05 00:26:12 +01:00
parent 954fe0ae82
commit 9118574203
26 changed files with 2017 additions and 55 deletions

View File

@@ -3,3 +3,9 @@ package model
type ApiModel struct {
Api string `json:"api"`
}
// ServiceStatus represents a Windows service state
type ServiceStatus struct {
Name string `json:"name"`
Status string `json:"status"` // "running", "stopped", "pending"
}

21
local/model/config.go Normal file
View File

@@ -0,0 +1,21 @@
package model
import "time"
// Config tracks configuration modifications
type Config struct {
ID uint `gorm:"primaryKey"`
ServerID uint `gorm:"not null"`
ConfigFile string `gorm:"not null"` // e.g. "settings.json"
OldConfig string `gorm:"type:text"`
NewConfig string `gorm:"type:text"`
ChangedAt time.Time `gorm:"default:CURRENT_TIMESTAMP"`
}
type Configurations struct {
Configuration map[string]interface{}
Entrylist map[string]interface{}
Event map[string]interface{}
EventRules map[string]interface{}
Settings map[string]interface{}
}

32
local/model/lookup.go Normal file
View File

@@ -0,0 +1,32 @@
package model
// Track represents a track and its capacity
type Track struct {
Name string `json:"track" gorm:"primaryKey;size:50"`
UniquePitBoxes int `json:"unique_pit_boxes"`
PrivateServerSlots int `json:"private_server_slots"`
}
// CarModel represents a car model mapping
type CarModel struct {
Value int `json:"value" gorm:"primaryKey"`
CarModel string `json:"car_model"`
}
// DriverCategory represents driver skill categories
type DriverCategory struct {
Value int `json:"value" gorm:"primaryKey"`
Category string `json:"category"`
}
// CupCategory represents championship cup categories
type CupCategory struct {
Value int `json:"value" gorm:"primaryKey"`
Category string `json:"category"`
}
// SessionType represents session types
type SessionType struct {
Value int `json:"value" gorm:"primaryKey"`
SessionType string `json:"session_type"`
}

11
local/model/server.go Normal file
View File

@@ -0,0 +1,11 @@
package model
// Server represents an ACC server instance
type Server struct {
ID uint `gorm:"primaryKey"`
Name string `gorm:"not null"`
IP string `gorm:"not null"`
Port int `gorm:"not null"`
ConfigPath string `gorm:"not null"` // e.g. "/acc/servers/server1/"
ServiceName string `gorm:"not null"` // Windows service name
}