get server by id

This commit is contained in:
Fran Jurmanović
2025-02-13 01:09:16 +01:00
parent 6fbc718a47
commit d5140783ca
7 changed files with 165 additions and 98 deletions

View File

@@ -4,76 +4,76 @@ 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"`
ID uint `json:"id" gorm:"primaryKey"`
ServerID uint `json:"serverId" gorm:"not null"`
ConfigFile string `json:"configFile" gorm:"not null"` // e.g. "settings.json"
OldConfig string `json:"oldConfig" gorm:"type:text"`
NewConfig string `json:"newConfig" gorm:"type:text"`
ChangedAt time.Time `json:"changedAt" 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{}
Configuration map[string]interface{} `json:"configuration"`
Entrylist map[string]interface{} `json:"entrylist"`
Event map[string]interface{} `json:"event"`
EventRules map[string]interface{} `json:"eventRules"`
Settings map[string]interface{} `json:"settings"`
}
type ServerSettings struct {
ServerName string `json:"serverName"`
AdminPassword string `json:"adminPassword"`
CarGroup string `json:"carGroup"`
TrackMedalsRequirement int `json:"trackMedalsRequirement"`
SafetyRatingRequirement int `json:"safetyRatingRequirement"`
RacecraftRatingRequirement int `json:"racecraftRatingRequirement"`
Password string `json:"password"`
SpectatorPassword string `json:"spectatorPassword"`
MaxCarSlots int `json:"maxCarSlots"`
DumpLeaderboards int `json:"dumpLeaderboards"`
IsRaceLocked int `json:"isRaceLocked"`
RandomizeTrackWhenEmpty int `json:"randomizeTrackWhenEmpty"`
CentralEntryListPath string `json:"centralEntryListPath"`
AllowAutoDQ int `json:"allowAutoDQ"`
ShortFormationLap int `json:"shortFormationLap"`
FormationLapType int `json:"formationLapType"`
IgnorePrematureDisconnects int `json:"ignorePrematureDisconnects"`
ServerName string `json:"serverName"`
AdminPassword string `json:"adminPassword"`
CarGroup string `json:"carGroup"`
TrackMedalsRequirement int `json:"trackMedalsRequirement"`
SafetyRatingRequirement int `json:"safetyRatingRequirement"`
RacecraftRatingRequirement int `json:"racecraftRatingRequirement"`
Password string `json:"password"`
SpectatorPassword string `json:"spectatorPassword"`
MaxCarSlots int `json:"maxCarSlots"`
DumpLeaderboards int `json:"dumpLeaderboards"`
IsRaceLocked int `json:"isRaceLocked"`
RandomizeTrackWhenEmpty int `json:"randomizeTrackWhenEmpty"`
CentralEntryListPath string `json:"centralEntryListPath"`
AllowAutoDQ int `json:"allowAutoDQ"`
ShortFormationLap int `json:"shortFormationLap"`
FormationLapType int `json:"formationLapType"`
IgnorePrematureDisconnects int `json:"ignorePrematureDisconnects"`
}
type EventConfig struct {
Track string `json:"track"`
PreRaceWaitingTimeSeconds int `json:"preRaceWaitingTimeSeconds"`
SessionOverTimeSeconds int `json:"sessionOverTimeSeconds"`
AmbientTemp int `json:"ambientTemp"`
CloudLevel float64 `json:"cloudLevel"`
Rain float64 `json:"rain"`
WeatherRandomness int `json:"weatherRandomness"`
PostQualySeconds int `json:"postQualySeconds"`
PostRaceSeconds int `json:"postRaceSeconds"`
SimracerWeatherConditions int `json:"simracerWeatherConditions"`
IsFixedConditionQualification int `json:"isFixedConditionQualification"`
Sessions []Session `json:"sessions"`
Track string `json:"track"`
PreRaceWaitingTimeSeconds int `json:"preRaceWaitingTimeSeconds"`
SessionOverTimeSeconds int `json:"sessionOverTimeSeconds"`
AmbientTemp int `json:"ambientTemp"`
CloudLevel float64 `json:"cloudLevel"`
Rain float64 `json:"rain"`
WeatherRandomness int `json:"weatherRandomness"`
PostQualySeconds int `json:"postQualySeconds"`
PostRaceSeconds int `json:"postRaceSeconds"`
SimracerWeatherConditions int `json:"simracerWeatherConditions"`
IsFixedConditionQualification int `json:"isFixedConditionQualification"`
Sessions []Session `json:"sessions"`
}
type Session struct {
HourOfDay int `json:"hourOfDay"`
DayOfWeekend int `json:"dayOfWeekend"`
TimeMultiplier int `json:"timeMultiplier"`
SessionType string `json:"sessionType"`
SessionDurationMinutes int `json:"sessionDurationMinutes"`
HourOfDay int `json:"hourOfDay"`
DayOfWeekend int `json:"dayOfWeekend"`
TimeMultiplier int `json:"timeMultiplier"`
SessionType string `json:"sessionType"`
SessionDurationMinutes int `json:"sessionDurationMinutes"`
}
type EventRules struct {
QualifyStandingType int `json:"qualifyStandingType"`
PitWindowLengthSec int `json:"pitWindowLengthSec"`
DriverStintTimeSec int `json:"driverStintTimeSec"`
MandatoryPitstopCount int `json:"mandatoryPitstopCount"`
MaxTotalDrivingTime int `json:"maxTotalDrivingTime"`
IsRefuellingAllowedInRace bool `json:"isRefuellingAllowedInRace"`
IsRefuellingTimeFixed bool `json:"isRefuellingTimeFixed"`
IsMandatoryPitstopRefuellingRequired bool `json:"isMandatoryPitstopRefuellingRequired"`
IsMandatoryPitstopTyreChangeRequired bool `json:"isMandatoryPitstopTyreChangeRequired"`
IsMandatoryPitstopSwapDriverRequired bool `json:"isMandatoryPitstopSwapDriverRequired"`
TyreSetCount int `json:"tyreSetCount"`
}
QualifyStandingType int `json:"qualifyStandingType"`
PitWindowLengthSec int `json:"pitWindowLengthSec"`
DriverStintTimeSec int `json:"driverStintTimeSec"`
MandatoryPitstopCount int `json:"mandatoryPitstopCount"`
MaxTotalDrivingTime int `json:"maxTotalDrivingTime"`
IsRefuellingAllowedInRace bool `json:"isRefuellingAllowedInRace"`
IsRefuellingTimeFixed bool `json:"isRefuellingTimeFixed"`
IsMandatoryPitstopRefuellingRequired bool `json:"isMandatoryPitstopRefuellingRequired"`
IsMandatoryPitstopTyreChangeRequired bool `json:"isMandatoryPitstopTyreChangeRequired"`
IsMandatoryPitstopSwapDriverRequired bool `json:"isMandatoryPitstopSwapDriverRequired"`
TyreSetCount int `json:"tyreSetCount"`
}