aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/controllers/mapController.go8
-rw-r--r--backend/models/models.go1
2 files changed, 5 insertions, 4 deletions
diff --git a/backend/controllers/mapController.go b/backend/controllers/mapController.go
index b5984dc..77f8e10 100644
--- a/backend/controllers/mapController.go
+++ b/backend/controllers/mapController.go
@@ -28,12 +28,12 @@ func FetchMapSummary(c *gin.Context) {
28 } 28 }
29 // Get map data 29 // Get map data
30 response.Map.ID = intID 30 response.Map.ID = intID
31 sql := `SELECT m.id, g.name, c.name, m.name 31 sql := `SELECT m.id, g.name, c.name, m.name, m.image
32 FROM maps m 32 FROM maps m
33 INNER JOIN games g ON m.game_id = g.id 33 INNER JOIN games g ON m.game_id = g.id
34 INNER JOIN chapters c ON m.chapter_id = c.id 34 INNER JOIN chapters c ON m.chapter_id = c.id
35 WHERE m.id = $1` 35 WHERE m.id = $1`
36 err = database.DB.QueryRow(sql, id).Scan(&response.Map.ID, &response.Map.GameName, &response.Map.ChapterName, &response.Map.MapName) 36 err = database.DB.QueryRow(sql, id).Scan(&response.Map.ID, &response.Map.GameName, &response.Map.ChapterName, &response.Map.MapName, &response.Map.Image)
37 if err != nil { 37 if err != nil {
38 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) 38 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error()))
39 return 39 return
@@ -89,12 +89,12 @@ func FetchMapLeaderboards(c *gin.Context) {
89 return 89 return
90 } 90 }
91 mapData.ID = intID 91 mapData.ID = intID
92 sql := `SELECT g.name, c.name, m.name, is_disabled 92 sql := `SELECT g.name, c.name, m.name, is_disabled, m.image
93 FROM maps m 93 FROM maps m
94 INNER JOIN games g ON m.game_id = g.id 94 INNER JOIN games g ON m.game_id = g.id
95 INNER JOIN chapters c ON m.chapter_id = c.id 95 INNER JOIN chapters c ON m.chapter_id = c.id
96 WHERE m.id = $1` 96 WHERE m.id = $1`
97 err = database.DB.QueryRow(sql, id).Scan(&mapData.GameName, &mapData.ChapterName, &mapData.MapName, &isDisabled) 97 err = database.DB.QueryRow(sql, id).Scan(&mapData.GameName, &mapData.ChapterName, &mapData.MapName, &isDisabled, &mapData.Image)
98 if err != nil { 98 if err != nil {
99 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) 99 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error()))
100 return 100 return
diff --git a/backend/models/models.go b/backend/models/models.go
index 0727468..7b8cbc4 100644
--- a/backend/models/models.go
+++ b/backend/models/models.go
@@ -23,6 +23,7 @@ type Map struct {
23 GameName string `json:"game_name"` 23 GameName string `json:"game_name"`
24 ChapterName string `json:"chapter_name"` 24 ChapterName string `json:"chapter_name"`
25 MapName string `json:"map_name"` 25 MapName string `json:"map_name"`
26 Image string `json:"image"`
26} 27}
27 28
28type MapShort struct { 29type MapShort struct {