add server api get and update service control endpoints
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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"`
|
||||
|
||||
@@ -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"`
|
||||
}
|
||||
Reference in New Issue
Block a user