diff options
Diffstat (limited to 'backend/controllers/mapController.go')
| -rw-r--r-- | backend/controllers/mapController.go | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/backend/controllers/mapController.go b/backend/controllers/mapController.go index 7a26554..52b6623 100644 --- a/backend/controllers/mapController.go +++ b/backend/controllers/mapController.go | |||
| @@ -11,13 +11,13 @@ import ( | |||
| 11 | 11 | ||
| 12 | // GET Map Summary | 12 | // GET Map Summary |
| 13 | // | 13 | // |
| 14 | // @Summary Get map summary with specified id. | 14 | // @Description Get map summary with specified id. |
| 15 | // @Tags maps | 15 | // @Tags maps |
| 16 | // @Produce json | 16 | // @Produce json |
| 17 | // @Param id path int true "Map ID" | 17 | // @Param id path int true "Map ID" |
| 18 | // @Success 200 {object} models.Response{data=models.MapSummaryResponse} | 18 | // @Success 200 {object} models.Response{data=models.MapSummaryResponse} |
| 19 | // @Failure 400 {object} models.Response | 19 | // @Failure 400 {object} models.Response |
| 20 | // @Router /maps/{id}/summary [get] | 20 | // @Router /maps/{id}/summary [get] |
| 21 | func FetchMapSummary(c *gin.Context) { | 21 | func FetchMapSummary(c *gin.Context) { |
| 22 | id := c.Param("id") | 22 | id := c.Param("id") |
| 23 | response := models.MapSummaryResponse{Map: models.Map{}, Summary: models.MapSummary{Routes: []models.MapRoute{}}} | 23 | response := models.MapSummaryResponse{Map: models.Map{}, Summary: models.MapSummary{Routes: []models.MapRoute{}}} |
| @@ -69,13 +69,13 @@ func FetchMapSummary(c *gin.Context) { | |||
| 69 | 69 | ||
| 70 | // GET Map Leaderboards | 70 | // GET Map Leaderboards |
| 71 | // | 71 | // |
| 72 | // @Summary Get map leaderboards with specified id. | 72 | // @Description Get map leaderboards with specified id. |
| 73 | // @Tags maps | 73 | // @Tags maps |
| 74 | // @Produce json | 74 | // @Produce json |
| 75 | // @Param id path int true "Map ID" | 75 | // @Param id path int true "Map ID" |
| 76 | // @Success 200 {object} models.Response{data=models.Map{data=models.MapRecords}} | 76 | // @Success 200 {object} models.Response{data=models.Map{data=models.MapRecords}} |
| 77 | // @Failure 400 {object} models.Response | 77 | // @Failure 400 {object} models.Response |
| 78 | // @Router /maps/{id}/leaderboards [get] | 78 | // @Router /maps/{id}/leaderboards [get] |
| 79 | func FetchMapLeaderboards(c *gin.Context) { | 79 | func FetchMapLeaderboards(c *gin.Context) { |
| 80 | // TODO: make new response type | 80 | // TODO: make new response type |
| 81 | id := c.Param("id") | 81 | id := c.Param("id") |
| @@ -186,12 +186,12 @@ func FetchMapLeaderboards(c *gin.Context) { | |||
| 186 | 186 | ||
| 187 | // GET Games | 187 | // GET Games |
| 188 | // | 188 | // |
| 189 | // @Summary Get games from the leaderboards. | 189 | // @Description Get games from the leaderboards. |
| 190 | // @Tags games & chapters | 190 | // @Tags games & chapters |
| 191 | // @Produce json | 191 | // @Produce json |
| 192 | // @Success 200 {object} models.Response{data=[]models.Game} | 192 | // @Success 200 {object} models.Response{data=[]models.Game} |
| 193 | // @Failure 400 {object} models.Response | 193 | // @Failure 400 {object} models.Response |
| 194 | // @Router /games [get] | 194 | // @Router /games [get] |
| 195 | func FetchGames(c *gin.Context) { | 195 | func FetchGames(c *gin.Context) { |
| 196 | rows, err := database.DB.Query(`SELECT id, name FROM games`) | 196 | rows, err := database.DB.Query(`SELECT id, name FROM games`) |
| 197 | if err != nil { | 197 | if err != nil { |
| @@ -216,13 +216,13 @@ func FetchGames(c *gin.Context) { | |||
| 216 | 216 | ||
| 217 | // GET Chapters of a Game | 217 | // GET Chapters of a Game |
| 218 | // | 218 | // |
| 219 | // @Summary Get chapters from the specified game id. | 219 | // @Description Get chapters from the specified game id. |
| 220 | // @Tags games & chapters | 220 | // @Tags games & chapters |
| 221 | // @Produce json | 221 | // @Produce json |
| 222 | // @Param id path int true "Game ID" | 222 | // @Param id path int true "Game ID" |
| 223 | // @Success 200 {object} models.Response{data=models.ChaptersResponse} | 223 | // @Success 200 {object} models.Response{data=models.ChaptersResponse} |
| 224 | // @Failure 400 {object} models.Response | 224 | // @Failure 400 {object} models.Response |
| 225 | // @Router /games/{id} [get] | 225 | // @Router /games/{id} [get] |
| 226 | func FetchChapters(c *gin.Context) { | 226 | func FetchChapters(c *gin.Context) { |
| 227 | gameID := c.Param("id") | 227 | gameID := c.Param("id") |
| 228 | intID, err := strconv.Atoi(gameID) | 228 | intID, err := strconv.Atoi(gameID) |
| @@ -258,13 +258,13 @@ func FetchChapters(c *gin.Context) { | |||
| 258 | 258 | ||
| 259 | // GET Maps of a Chapter | 259 | // GET Maps of a Chapter |
| 260 | // | 260 | // |
| 261 | // @Summary Get maps from the specified chapter id. | 261 | // @Description Get maps from the specified chapter id. |
| 262 | // @Tags games & chapters | 262 | // @Tags games & chapters |
| 263 | // @Produce json | 263 | // @Produce json |
| 264 | // @Param id path int true "Chapter ID" | 264 | // @Param id path int true "Chapter ID" |
| 265 | // @Success 200 {object} models.Response{data=models.ChapterMapsResponse} | 265 | // @Success 200 {object} models.Response{data=models.ChapterMapsResponse} |
| 266 | // @Failure 400 {object} models.Response | 266 | // @Failure 400 {object} models.Response |
| 267 | // @Router /chapters/{id} [get] | 267 | // @Router /chapters/{id} [get] |
| 268 | func FetchChapterMaps(c *gin.Context) { | 268 | func FetchChapterMaps(c *gin.Context) { |
| 269 | chapterID := c.Param("id") | 269 | chapterID := c.Param("id") |
| 270 | intID, err := strconv.Atoi(chapterID) | 270 | intID, err := strconv.Atoi(chapterID) |