don't join the other tables, let the client ask the API in the other endpoints

This commit is contained in:
Chris Cromer 2023-02-01 14:31:40 -03:00 committed by Martin Araneda
parent 3f931f5ef8
commit e7bed8124c

View File

@ -58,7 +58,7 @@ func ListGames(writer http.ResponseWriter, request *http.Request, params httprou
var games []models.Game var games []models.Game
result := gdb.Model(&models.Game{}).Order("ID asc").Joins("Player").Joins("Level").Joins("OS").Joins("GodotVersion").Find(&games) result := gdb.Model(&models.Game{}).Order("ID asc").Find(&games)
if result.Error != nil { if result.Error != nil {
utils.JSONErrorOutput(writer, http.StatusBadRequest, result.Error.Error()) utils.JSONErrorOutput(writer, http.StatusBadRequest, result.Error.Error())
return return
@ -76,7 +76,7 @@ func GetGame(writer http.ResponseWriter, request *http.Request, params httproute
var game models.Game var game models.Game
result := gdb.Model(&models.Game{}).Order("ID asc").Joins("Player").Joins("Level").Joins("OS").Find(&game, params.ByName("id")) result := gdb.Model(&models.Game{}).Order("ID asc").Find(&game, params.ByName("id"))
if result.Error != nil { if result.Error != nil {
utils.JSONErrorOutput(writer, http.StatusBadRequest, result.Error.Error()) utils.JSONErrorOutput(writer, http.StatusBadRequest, result.Error.Error())
return return