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

@@ -35,9 +35,9 @@ type ConfigFilter struct {
}
// ApiFilter defines filtering options for Api queries
type ApiFilter struct {
type ServiceControlFilter struct {
BaseFilter
Api string `query:"api"`
ServiceControl string `query:"serviceControl"`
}
// MembershipFilter defines filtering options for User queries

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"`

View File

@@ -104,6 +104,6 @@ func (s ServiceStatus) Value() (driver.Value, error) {
return s.String(), nil
}
type ApiModel struct {
Api string `json:"api"`
type ServiceControlModel struct {
ServiceControl string `json:"serviceControl"`
}