nquest/pkg/controller/game.go

28 lines
475 B
Go
Raw Normal View History

2023-11-01 23:21:12 +03:00
package controller
import (
"net/http"
"github.com/labstack/echo/v4"
"gitrepo.ru/neonxp/nquest/pkg/models"
"gitrepo.ru/neonxp/nquest/pkg/service"
)
type Game struct {
GameService *service.Game
}
func (index *Game) Index(c echo.Context) error {
games, err := index.GameService.List(c.Request().Context())
if err != nil {
return err
}
return c.Render(http.StatusOK, "index", &GamesResponse{Games: games})
}
type GamesResponse struct {
Games []*models.Game
}