add handlers method

This commit is contained in:
Jeffrey Duroyon
2020-05-17 00:12:54 +02:00
parent 9e171382f0
commit afb841e7bf
3 changed files with 97 additions and 5 deletions

View File

@@ -10,7 +10,13 @@ import (
)
func (hc *handlersContext) getAllGames(c *gin.Context) {
users, err := hc.db.GetAllGames()
if err != nil {
utils.GetLoggerFromCtx(c).WithError(err).Error("error while getting games")
utils.JSONErrorWithMessage(c.Writer, model.ErrInternalServer, "Error while getting games")
return
}
utils.JSON(c.Writer, http.StatusOK, users)
}
func (hc *handlersContext) getAGame(c *gin.Context) {