get server by id

This commit is contained in:
Fran Jurmanović
2025-02-13 01:09:16 +01:00
parent 6fbc718a47
commit d5140783ca
7 changed files with 165 additions and 98 deletions

View File

@@ -25,6 +25,7 @@ func NewServerController(as *service.ServerService, routeGroups *common.RouteGro
}
routeGroups.Server.Get("/", ac.getAll)
routeGroups.Server.Get("/:id", ac.getById)
return ac
}
@@ -40,3 +41,16 @@ func (ac *ServerController) getAll(c *fiber.Ctx) error {
ServerModel := ac.service.GetAll(c)
return c.JSON(ServerModel)
}
// getById returns Servers
//
// @Summary Return Servers
// @Description Return Servers
// @Tags Server
// @Success 200 {array} string
// @Router /v1/server [get]
func (ac *ServerController) getById(c *fiber.Ctx) error {
serverID, _ := c.ParamsInt("id")
ServerModel := ac.service.GetById(c, serverID)
return c.JSON(ServerModel)
}