add server api get and update service control endpoints

This commit is contained in:
Fran Jurmanović
2025-07-29 20:50:44 +02:00
parent 44acb170a7
commit 647f4f7487
27 changed files with 424 additions and 2025 deletions

View File

@@ -16,6 +16,25 @@ const (
ServiceNamePrefix = "ACC-Server"
)
// Server represents an ACC server instance
type ServerAPI struct {
Name string `json:"name"`
Status ServiceStatus `json:"status"`
State *ServerState `json:"state"`
PlayerCount int `json:"playerCount"`
Track string `json:"track"`
}
func (s *Server) ToServerAPI() *ServerAPI {
return &ServerAPI{
Name: s.Name,
Status: s.Status,
State: s.State,
PlayerCount: s.State.PlayerCount,
Track: s.State.Track,
}
}
// Server represents an ACC server instance
type Server struct {
ID uuid.UUID `gorm:"type:uuid;primary_key;" json:"id"`