Files
acc-server-manager/local/controller/server.go
2025-02-05 00:26:12 +01:00

43 lines
929 B
Go

package controller
import (
"acc-server-manager/local/service"
"acc-server-manager/local/utl/common"
"github.com/gofiber/fiber/v2"
)
type ServerController struct {
service *service.ServerService
}
// NewServerController
// Initializes ServerController.
//
// Args:
// *services.ServerService: Server service
// *Fiber.RouterGroup: Fiber Router Group
// Returns:
// *ServerController: Controller for "Server" interactions
func NewServerController(as *service.ServerService, routeGroups *common.RouteGroups) *ServerController {
ac := &ServerController{
service: as,
}
routeGroups.Server.Get("/", ac.getAll)
return ac
}
// getAll returns Servers
//
// @Summary Return Servers
// @Description Return Servers
// @Tags Server
// @Success 200 {array} string
// @Router /v1/server [get]
func (ac *ServerController) getAll(c *fiber.Ctx) error {
ServerModel := ac.service.GetAll(c)
return c.JSON(ServerModel)
}