update docs
This commit is contained in:
@@ -13,7 +13,7 @@ import (
|
||||
|
||||
type ConfigController struct {
|
||||
service *service.ConfigService
|
||||
apiService *service.ApiService
|
||||
apiService *service.ServiceControlService
|
||||
errorHandler *error_handler.ControllerErrorHandler
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ type ConfigController struct {
|
||||
// *Fiber.RouterGroup: Fiber Router Group
|
||||
// Returns:
|
||||
// *ConfigController: Controller for "Config" interactions
|
||||
func NewConfigController(as *service.ConfigService, routeGroups *common.RouteGroups, as2 *service.ApiService, auth *middleware.AuthMiddleware) *ConfigController {
|
||||
func NewConfigController(as *service.ConfigService, routeGroups *common.RouteGroups, as2 *service.ServiceControlService, auth *middleware.AuthMiddleware) *ConfigController {
|
||||
ac := &ConfigController{
|
||||
service: as,
|
||||
apiService: as2,
|
||||
@@ -43,13 +43,21 @@ func NewConfigController(as *service.ConfigService, routeGroups *common.RouteGro
|
||||
|
||||
// updateConfig returns Config
|
||||
//
|
||||
// @Summary Update config
|
||||
// @Description Updates config
|
||||
// @Param id path number true "required"
|
||||
// @Param file path string true "required"
|
||||
// @Param content body string true "required"
|
||||
// @Tags Config
|
||||
// @Success 200 {array} string
|
||||
// @Summary Update server configuration file
|
||||
// @Description Update a specific configuration file for an ACC server
|
||||
// @Tags Server Configuration
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Server ID (UUID format)"
|
||||
// @Param file path string true "Config file name (e.g., configuration.json, settings.json, event.json)"
|
||||
// @Param content body object true "Configuration file content as JSON"
|
||||
// @Success 200 {object} object{message=string} "Update successful"
|
||||
// @Failure 400 {object} error_handler.ErrorResponse "Invalid request or JSON format"
|
||||
// @Failure 401 {object} error_handler.ErrorResponse "Unauthorized"
|
||||
// @Failure 403 {object} error_handler.ErrorResponse "Insufficient permissions"
|
||||
// @Failure 404 {object} error_handler.ErrorResponse "Server or config file not found"
|
||||
// @Failure 500 {object} error_handler.ErrorResponse "Internal server error"
|
||||
// @Security BearerAuth
|
||||
// @Router /v1/server/{id}/config/{file} [put]
|
||||
func (ac *ConfigController) UpdateConfig(c *fiber.Ctx) error {
|
||||
restart := c.QueryBool("restart")
|
||||
@@ -73,7 +81,7 @@ func (ac *ConfigController) UpdateConfig(c *fiber.Ctx) error {
|
||||
}
|
||||
logging.Info("restart: %v", restart)
|
||||
if restart {
|
||||
_, err := ac.apiService.ApiRestartServer(c)
|
||||
_, err := ac.apiService.ServiceControlRestartServer(c)
|
||||
if err != nil {
|
||||
logging.ErrorWithContext("CONFIG_RESTART", "Failed to restart server after config update: %v", err)
|
||||
}
|
||||
@@ -84,12 +92,20 @@ func (ac *ConfigController) UpdateConfig(c *fiber.Ctx) error {
|
||||
|
||||
// getConfig returns Config
|
||||
//
|
||||
// @Summary Return Config file
|
||||
// @Description Returns Config file
|
||||
// @Param id path number true "required"
|
||||
// @Param file path string true "required"
|
||||
// @Tags Config
|
||||
// @Success 200 {array} string
|
||||
// @Summary Get server configuration file
|
||||
// @Description Retrieve a specific configuration file for an ACC server
|
||||
// @Tags Server Configuration
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Server ID (UUID format)"
|
||||
// @Param file path string true "Config file name (e.g., configuration.json, settings.json, event.json)"
|
||||
// @Success 200 {object} object "Configuration file content as JSON"
|
||||
// @Failure 400 {object} error_handler.ErrorResponse "Invalid server ID"
|
||||
// @Failure 401 {object} error_handler.ErrorResponse "Unauthorized"
|
||||
// @Failure 403 {object} error_handler.ErrorResponse "Insufficient permissions"
|
||||
// @Failure 404 {object} error_handler.ErrorResponse "Server or config file not found"
|
||||
// @Failure 500 {object} error_handler.ErrorResponse "Internal server error"
|
||||
// @Security BearerAuth
|
||||
// @Router /v1/server/{id}/config/{file} [get]
|
||||
func (ac *ConfigController) GetConfig(c *fiber.Ctx) error {
|
||||
Model, err := ac.service.GetConfig(c)
|
||||
@@ -101,11 +117,19 @@ func (ac *ConfigController) GetConfig(c *fiber.Ctx) error {
|
||||
|
||||
// getConfigs returns Config
|
||||
//
|
||||
// @Summary Return Configs
|
||||
// @Description Return Config files
|
||||
// @Param id path number true "required"
|
||||
// @Tags Config
|
||||
// @Success 200 {array} string
|
||||
// @Summary List available configuration files
|
||||
// @Description Get a list of all available configuration files for an ACC server
|
||||
// @Tags Server Configuration
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Server ID (UUID format)"
|
||||
// @Success 200 {array} string "List of available configuration files"
|
||||
// @Failure 400 {object} error_handler.ErrorResponse "Invalid server ID"
|
||||
// @Failure 401 {object} error_handler.ErrorResponse "Unauthorized"
|
||||
// @Failure 403 {object} error_handler.ErrorResponse "Insufficient permissions"
|
||||
// @Failure 404 {object} error_handler.ErrorResponse "Server not found"
|
||||
// @Failure 500 {object} error_handler.ErrorResponse "Internal server error"
|
||||
// @Security BearerAuth
|
||||
// @Router /v1/server/{id}/config [get]
|
||||
func (ac *ConfigController) GetConfigs(c *fiber.Ctx) error {
|
||||
Model, err := ac.service.GetConfigs(c)
|
||||
|
||||
Reference in New Issue
Block a user