aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>2023-08-20 12:51:26 +0300
committerArda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>2023-08-20 12:51:26 +0300
commitca7acc2fdc6e6c8371ca5bbeeaabb02d11bb1bee (patch)
tree1196cbb2b253ecaddd80934cc849cfd52f68b3e4
parentfix: change map history from timestamp to date (diff)
downloadlphub-ca7acc2fdc6e6c8371ca5bbeeaabb02d11bb1bee.tar.gz
lphub-ca7acc2fdc6e6c8371ca5bbeeaabb02d11bb1bee.tar.bz2
lphub-ca7acc2fdc6e6c8371ca5bbeeaabb02d11bb1bee.zip
refactor: move structs around for better understanding
Former-commit-id: 0030a6b0c7b228772d8e27f5722ee6de1718786b
-rw-r--r--backend/controllers/homeController.go18
-rw-r--r--backend/controllers/loginController.go16
-rw-r--r--backend/controllers/mapController.go27
-rw-r--r--backend/controllers/modController.go67
-rw-r--r--backend/controllers/recordController.go20
-rw-r--r--backend/controllers/userController.go43
-rw-r--r--backend/models/models.go14
-rw-r--r--backend/models/requests.go39
-rw-r--r--backend/models/responses.go64
-rw-r--r--docs/docs.go300
-rw-r--r--docs/swagger.json300
-rw-r--r--docs/swagger.yaml216
12 files changed, 560 insertions, 564 deletions
diff --git a/backend/controllers/homeController.go b/backend/controllers/homeController.go
index c94590a..d1b99cb 100644
--- a/backend/controllers/homeController.go
+++ b/backend/controllers/homeController.go
@@ -10,6 +10,16 @@ import (
10 "github.com/pektezol/leastportalshub/backend/models" 10 "github.com/pektezol/leastportalshub/backend/models"
11) 11)
12 12
13type SearchResponse struct {
14 Players []models.UserShort `json:"players"`
15 Maps []models.MapShort `json:"maps"`
16}
17
18type RankingsResponse struct {
19 RankingsSP []models.UserRanking `json:"rankings_sp"`
20 RankingsMP []models.UserRanking `json:"rankings_mp"`
21}
22
13func Home(c *gin.Context) { 23func Home(c *gin.Context) {
14 user, exists := c.Get("user") 24 user, exists := c.Get("user")
15 if !exists { 25 if !exists {
@@ -26,7 +36,7 @@ func Home(c *gin.Context) {
26// @Description Get rankings of every player. 36// @Description Get rankings of every player.
27// @Tags rankings 37// @Tags rankings
28// @Produce json 38// @Produce json
29// @Success 200 {object} models.Response{data=models.RankingsResponse} 39// @Success 200 {object} models.Response{data=RankingsResponse}
30// @Failure 400 {object} models.Response 40// @Failure 400 {object} models.Response
31// @Router /rankings [get] 41// @Router /rankings [get]
32func Rankings(c *gin.Context) { 42func Rankings(c *gin.Context) {
@@ -116,7 +126,7 @@ func Rankings(c *gin.Context) {
116 c.JSON(http.StatusOK, models.Response{ 126 c.JSON(http.StatusOK, models.Response{
117 Success: true, 127 Success: true,
118 Message: "Successfully retrieved rankings.", 128 Message: "Successfully retrieved rankings.",
119 Data: models.RankingsResponse{ 129 Data: RankingsResponse{
120 RankingsSP: spRankings, 130 RankingsSP: spRankings,
121 RankingsMP: mpRankings, 131 RankingsMP: mpRankings,
122 }, 132 },
@@ -129,14 +139,14 @@ func Rankings(c *gin.Context) {
129// @Tags search 139// @Tags search
130// @Produce json 140// @Produce json
131// @Param q query string false "Search user or map name." 141// @Param q query string false "Search user or map name."
132// @Success 200 {object} models.Response{data=models.SearchResponse} 142// @Success 200 {object} models.Response{data=SearchResponse}
133// @Failure 400 {object} models.Response 143// @Failure 400 {object} models.Response
134// @Router /search [get] 144// @Router /search [get]
135func SearchWithQuery(c *gin.Context) { 145func SearchWithQuery(c *gin.Context) {
136 query := c.Query("q") 146 query := c.Query("q")
137 query = strings.ToLower(query) 147 query = strings.ToLower(query)
138 log.Println(query) 148 log.Println(query)
139 var response models.SearchResponse 149 var response SearchResponse
140 // Cache all maps for faster response 150 // Cache all maps for faster response
141 var maps = []models.MapShort{ 151 var maps = []models.MapShort{
142 {ID: 1, Name: "Container Ride"}, 152 {ID: 1, Name: "Container Ride"},
diff --git a/backend/controllers/loginController.go b/backend/controllers/loginController.go
index e907b22..76bf51f 100644
--- a/backend/controllers/loginController.go
+++ b/backend/controllers/loginController.go
@@ -15,13 +15,17 @@ import (
15 "github.com/solovev/steam_go" 15 "github.com/solovev/steam_go"
16) 16)
17 17
18type LoginResponse struct {
19 Token string `json:"token"`
20}
21
18// Login 22// Login
19// 23//
20// @Description Get (redirect) login page for Steam auth. 24// @Description Get (redirect) login page for Steam auth.
21// @Tags login 25// @Tags login
22// @Accept json 26// @Accept json
23// @Produce json 27// @Produce json
24// @Success 200 {object} models.Response{data=models.LoginResponse} 28// @Success 200 {object} models.Response{data=LoginResponse}
25// @Failure 400 {object} models.Response 29// @Failure 400 {object} models.Response
26// @Router /login [get] 30// @Router /login [get]
27func Login(c *gin.Context) { 31func Login(c *gin.Context) {
@@ -85,7 +89,7 @@ func Login(c *gin.Context) {
85 // c.JSON(http.StatusOK, models.Response{ 89 // c.JSON(http.StatusOK, models.Response{
86 // Success: true, 90 // Success: true,
87 // Message: "Successfully generated token.", 91 // Message: "Successfully generated token.",
88 // Data: models.LoginResponse{ 92 // Data: LoginResponse{
89 // Token: tokenString, 93 // Token: tokenString,
90 // }, 94 // },
91 // }) 95 // })
@@ -99,7 +103,7 @@ func Login(c *gin.Context) {
99// @Tags auth 103// @Tags auth
100// @Produce json 104// @Produce json
101// 105//
102// @Success 200 {object} models.Response{data=models.LoginResponse} 106// @Success 200 {object} models.Response{data=LoginResponse}
103// @Failure 404 {object} models.Response 107// @Failure 404 {object} models.Response
104// @Router /token [get] 108// @Router /token [get]
105func GetCookie(c *gin.Context) { 109func GetCookie(c *gin.Context) {
@@ -111,7 +115,7 @@ func GetCookie(c *gin.Context) {
111 c.JSON(http.StatusOK, models.Response{ 115 c.JSON(http.StatusOK, models.Response{
112 Success: true, 116 Success: true,
113 Message: "Token cookie successfully retrieved.", 117 Message: "Token cookie successfully retrieved.",
114 Data: models.LoginResponse{ 118 Data: LoginResponse{
115 Token: cookie, 119 Token: cookie,
116 }, 120 },
117 }) 121 })
@@ -123,7 +127,7 @@ func GetCookie(c *gin.Context) {
123// @Tags auth 127// @Tags auth
124// @Produce json 128// @Produce json
125// 129//
126// @Success 200 {object} models.Response{data=models.LoginResponse} 130// @Success 200 {object} models.Response{data=LoginResponse}
127// @Failure 404 {object} models.Response 131// @Failure 404 {object} models.Response
128// @Router /token [delete] 132// @Router /token [delete]
129func DeleteCookie(c *gin.Context) { 133func DeleteCookie(c *gin.Context) {
@@ -136,7 +140,7 @@ func DeleteCookie(c *gin.Context) {
136 c.JSON(http.StatusOK, models.Response{ 140 c.JSON(http.StatusOK, models.Response{
137 Success: true, 141 Success: true,
138 Message: "Token cookie successfully deleted.", 142 Message: "Token cookie successfully deleted.",
139 Data: models.LoginResponse{ 143 Data: LoginResponse{
140 Token: cookie, 144 Token: cookie,
141 }, 145 },
142 }) 146 })
diff --git a/backend/controllers/mapController.go b/backend/controllers/mapController.go
index ebd65dd..0a324d6 100644
--- a/backend/controllers/mapController.go
+++ b/backend/controllers/mapController.go
@@ -9,18 +9,33 @@ import (
9 "github.com/pektezol/leastportalshub/backend/models" 9 "github.com/pektezol/leastportalshub/backend/models"
10) 10)
11 11
12type MapSummaryResponse struct {
13 Map models.Map `json:"map"`
14 Summary models.MapSummary `json:"summary"`
15}
16
17type ChaptersResponse struct {
18 Game models.Game `json:"game"`
19 Chapters []models.Chapter `json:"chapters"`
20}
21
22type ChapterMapsResponse struct {
23 Chapter models.Chapter `json:"chapter"`
24 Maps []models.MapShort `json:"maps"`
25}
26
12// GET Map Summary 27// GET Map Summary
13// 28//
14// @Description Get map summary with specified id. 29// @Description Get map summary with specified id.
15// @Tags maps 30// @Tags maps
16// @Produce json 31// @Produce json
17// @Param id path int true "Map ID" 32// @Param id path int true "Map ID"
18// @Success 200 {object} models.Response{data=models.MapSummaryResponse} 33// @Success 200 {object} models.Response{data=MapSummaryResponse}
19// @Failure 400 {object} models.Response 34// @Failure 400 {object} models.Response
20// @Router /maps/{id}/summary [get] 35// @Router /maps/{id}/summary [get]
21func FetchMapSummary(c *gin.Context) { 36func FetchMapSummary(c *gin.Context) {
22 id := c.Param("id") 37 id := c.Param("id")
23 response := models.MapSummaryResponse{Map: models.Map{}, Summary: models.MapSummary{Routes: []models.MapRoute{}}} 38 response := MapSummaryResponse{Map: models.Map{}, Summary: models.MapSummary{Routes: []models.MapRoute{}}}
24 intID, err := strconv.Atoi(id) 39 intID, err := strconv.Atoi(id)
25 if err != nil { 40 if err != nil {
26 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) 41 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error()))
@@ -220,7 +235,7 @@ func FetchGames(c *gin.Context) {
220// @Tags games & chapters 235// @Tags games & chapters
221// @Produce json 236// @Produce json
222// @Param id path int true "Game ID" 237// @Param id path int true "Game ID"
223// @Success 200 {object} models.Response{data=models.ChaptersResponse} 238// @Success 200 {object} models.Response{data=ChaptersResponse}
224// @Failure 400 {object} models.Response 239// @Failure 400 {object} models.Response
225// @Router /games/{id} [get] 240// @Router /games/{id} [get]
226func FetchChapters(c *gin.Context) { 241func FetchChapters(c *gin.Context) {
@@ -230,7 +245,7 @@ func FetchChapters(c *gin.Context) {
230 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) 245 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error()))
231 return 246 return
232 } 247 }
233 var response models.ChaptersResponse 248 var response ChaptersResponse
234 rows, err := database.DB.Query(`SELECT c.id, c.name, g.name FROM chapters c INNER JOIN games g ON c.game_id = g.id WHERE game_id = $1`, gameID) 249 rows, err := database.DB.Query(`SELECT c.id, c.name, g.name FROM chapters c INNER JOIN games g ON c.game_id = g.id WHERE game_id = $1`, gameID)
235 if err != nil { 250 if err != nil {
236 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) 251 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error()))
@@ -262,7 +277,7 @@ func FetchChapters(c *gin.Context) {
262// @Tags games & chapters 277// @Tags games & chapters
263// @Produce json 278// @Produce json
264// @Param id path int true "Chapter ID" 279// @Param id path int true "Chapter ID"
265// @Success 200 {object} models.Response{data=models.ChapterMapsResponse} 280// @Success 200 {object} models.Response{data=ChapterMapsResponse}
266// @Failure 400 {object} models.Response 281// @Failure 400 {object} models.Response
267// @Router /chapters/{id} [get] 282// @Router /chapters/{id} [get]
268func FetchChapterMaps(c *gin.Context) { 283func FetchChapterMaps(c *gin.Context) {
@@ -272,7 +287,7 @@ func FetchChapterMaps(c *gin.Context) {
272 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) 287 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error()))
273 return 288 return
274 } 289 }
275 var response models.ChapterMapsResponse 290 var response ChapterMapsResponse
276 rows, err := database.DB.Query(`SELECT m.id, m.name, c.name FROM maps m INNER JOIN chapters c ON m.chapter_id = c.id WHERE chapter_id = $1`, chapterID) 291 rows, err := database.DB.Query(`SELECT m.id, m.name, c.name FROM maps m INNER JOIN chapters c ON m.chapter_id = c.id WHERE chapter_id = $1`, chapterID)
277 if err != nil { 292 if err != nil {
278 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) 293 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error()))
diff --git a/backend/controllers/modController.go b/backend/controllers/modController.go
index e2add1f..7ce5cb4 100644
--- a/backend/controllers/modController.go
+++ b/backend/controllers/modController.go
@@ -3,21 +3,48 @@ package controllers
3import ( 3import (
4 "net/http" 4 "net/http"
5 "strconv" 5 "strconv"
6 "time"
6 7
7 "github.com/gin-gonic/gin" 8 "github.com/gin-gonic/gin"
8 "github.com/pektezol/leastportalshub/backend/database" 9 "github.com/pektezol/leastportalshub/backend/database"
9 "github.com/pektezol/leastportalshub/backend/models" 10 "github.com/pektezol/leastportalshub/backend/models"
10) 11)
11 12
13type CreateMapSummaryRequest struct {
14 CategoryID int `json:"category_id" binding:"required"`
15 Description string `json:"description" binding:"required"`
16 Showcase string `json:"showcase"`
17 UserName string `json:"user_name" binding:"required"`
18 ScoreCount *int `json:"score_count" binding:"required"`
19 RecordDate time.Time `json:"record_date" binding:"required"`
20}
21
22type EditMapSummaryRequest struct {
23 RouteID int `json:"route_id" binding:"required"`
24 Description string `json:"description" binding:"required"`
25 Showcase string `json:"showcase"`
26 UserName string `json:"user_name" binding:"required"`
27 ScoreCount *int `json:"score_count" binding:"required"`
28 RecordDate time.Time `json:"record_date" binding:"required"`
29}
30
31type DeleteMapSummaryRequest struct {
32 RouteID int `json:"route_id" binding:"required"`
33}
34
35type EditMapImageRequest struct {
36 Image string `json:"image" binding:"required"`
37}
38
12// POST Map Summary 39// POST Map Summary
13// 40//
14// @Description Create map summary with specified map id. 41// @Description Create map summary with specified map id.
15// @Tags maps 42// @Tags maps
16// @Produce json 43// @Produce json
17// @Param Authorization header string true "JWT Token" 44// @Param Authorization header string true "JWT Token"
18// @Param id path int true "Map ID" 45// @Param id path int true "Map ID"
19// @Param request body models.CreateMapSummaryRequest true "Body" 46// @Param request body CreateMapSummaryRequest true "Body"
20// @Success 200 {object} models.Response{data=models.CreateMapSummaryRequest} 47// @Success 200 {object} models.Response{data=CreateMapSummaryRequest}
21// @Failure 400 {object} models.Response 48// @Failure 400 {object} models.Response
22// @Router /maps/{id}/summary [post] 49// @Router /maps/{id}/summary [post]
23func CreateMapSummary(c *gin.Context) { 50func CreateMapSummary(c *gin.Context) {
@@ -44,7 +71,7 @@ func CreateMapSummary(c *gin.Context) {
44 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) 71 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error()))
45 return 72 return
46 } 73 }
47 var request models.CreateMapSummaryRequest 74 var request CreateMapSummaryRequest
48 if err := c.BindJSON(&request); err != nil { 75 if err := c.BindJSON(&request); err != nil {
49 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) 76 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error()))
50 return 77 return
@@ -100,10 +127,10 @@ func CreateMapSummary(c *gin.Context) {
100// @Description Edit map summary with specified map id. 127// @Description Edit map summary with specified map id.
101// @Tags maps 128// @Tags maps
102// @Produce json 129// @Produce json
103// @Param Authorization header string true "JWT Token" 130// @Param Authorization header string true "JWT Token"
104// @Param id path int true "Map ID" 131// @Param id path int true "Map ID"
105// @Param request body models.EditMapSummaryRequest true "Body" 132// @Param request body EditMapSummaryRequest true "Body"
106// @Success 200 {object} models.Response{data=models.EditMapSummaryRequest} 133// @Success 200 {object} models.Response{data=EditMapSummaryRequest}
107// @Failure 400 {object} models.Response 134// @Failure 400 {object} models.Response
108// @Router /maps/{id}/summary [put] 135// @Router /maps/{id}/summary [put]
109func EditMapSummary(c *gin.Context) { 136func EditMapSummary(c *gin.Context) {
@@ -130,7 +157,7 @@ func EditMapSummary(c *gin.Context) {
130 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) 157 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error()))
131 return 158 return
132 } 159 }
133 var request models.EditMapSummaryRequest 160 var request EditMapSummaryRequest
134 if err := c.BindJSON(&request); err != nil { 161 if err := c.BindJSON(&request); err != nil {
135 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) 162 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error()))
136 return 163 return
@@ -186,10 +213,10 @@ func EditMapSummary(c *gin.Context) {
186// @Description Delete map summary with specified map id. 213// @Description Delete map summary with specified map id.
187// @Tags maps 214// @Tags maps
188// @Produce json 215// @Produce json
189// @Param Authorization header string true "JWT Token" 216// @Param Authorization header string true "JWT Token"
190// @Param id path int true "Map ID" 217// @Param id path int true "Map ID"
191// @Param request body models.DeleteMapSummaryRequest true "Body" 218// @Param request body DeleteMapSummaryRequest true "Body"
192// @Success 200 {object} models.Response{data=models.DeleteMapSummaryRequest} 219// @Success 200 {object} models.Response{data=DeleteMapSummaryRequest}
193// @Failure 400 {object} models.Response 220// @Failure 400 {object} models.Response
194// @Router /maps/{id}/summary [delete] 221// @Router /maps/{id}/summary [delete]
195func DeleteMapSummary(c *gin.Context) { 222func DeleteMapSummary(c *gin.Context) {
@@ -216,7 +243,7 @@ func DeleteMapSummary(c *gin.Context) {
216 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) 243 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error()))
217 return 244 return
218 } 245 }
219 var request models.DeleteMapSummaryRequest 246 var request DeleteMapSummaryRequest
220 if err := c.BindJSON(&request); err != nil { 247 if err := c.BindJSON(&request); err != nil {
221 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) 248 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error()))
222 return 249 return
@@ -276,10 +303,10 @@ func DeleteMapSummary(c *gin.Context) {
276// @Description Edit map image with specified map id. 303// @Description Edit map image with specified map id.
277// @Tags maps 304// @Tags maps
278// @Produce json 305// @Produce json
279// @Param Authorization header string true "JWT Token" 306// @Param Authorization header string true "JWT Token"
280// @Param id path int true "Map ID" 307// @Param id path int true "Map ID"
281// @Param request body models.EditMapImageRequest true "Body" 308// @Param request body EditMapImageRequest true "Body"
282// @Success 200 {object} models.Response{data=models.EditMapImageRequest} 309// @Success 200 {object} models.Response{data=EditMapImageRequest}
283// @Failure 400 {object} models.Response 310// @Failure 400 {object} models.Response
284// @Router /maps/{id}/image [put] 311// @Router /maps/{id}/image [put]
285func EditMapImage(c *gin.Context) { 312func EditMapImage(c *gin.Context) {
@@ -306,7 +333,7 @@ func EditMapImage(c *gin.Context) {
306 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) 333 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error()))
307 return 334 return
308 } 335 }
309 var request models.EditMapImageRequest 336 var request EditMapImageRequest
310 if err := c.BindJSON(&request); err != nil { 337 if err := c.BindJSON(&request); err != nil {
311 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) 338 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error()))
312 return 339 return
diff --git a/backend/controllers/recordController.go b/backend/controllers/recordController.go
index 951be41..d141fc3 100644
--- a/backend/controllers/recordController.go
+++ b/backend/controllers/recordController.go
@@ -19,6 +19,18 @@ import (
19 "google.golang.org/api/drive/v3" 19 "google.golang.org/api/drive/v3"
20) 20)
21 21
22type RecordRequest struct {
23 HostDemo *multipart.FileHeader `json:"host_demo" form:"host_demo" binding:"required" swaggerignore:"true"`
24 PartnerDemo *multipart.FileHeader `json:"partner_demo" form:"partner_demo" swaggerignore:"true"`
25 IsPartnerOrange bool `json:"is_partner_orange" form:"is_partner_orange"`
26 PartnerID string `json:"partner_id" form:"partner_id"`
27}
28
29type RecordResponse struct {
30 ScoreCount int `json:"score_count"`
31 ScoreTime int `json:"score_time"`
32}
33
22// POST Record 34// POST Record
23// 35//
24// @Description Post record with demo of a specific map. 36// @Description Post record with demo of a specific map.
@@ -31,7 +43,7 @@ import (
31// @Param partner_demo formData file false "Partner Demo" 43// @Param partner_demo formData file false "Partner Demo"
32// @Param is_partner_orange formData boolean false "Is Partner Orange" 44// @Param is_partner_orange formData boolean false "Is Partner Orange"
33// @Param partner_id formData string false "Partner ID" 45// @Param partner_id formData string false "Partner ID"
34// @Success 200 {object} models.Response{data=models.RecordResponse} 46// @Success 200 {object} models.Response{data=RecordResponse}
35// @Failure 400 {object} models.Response 47// @Failure 400 {object} models.Response
36// @Failure 401 {object} models.Response 48// @Failure 401 {object} models.Response
37// @Router /maps/{id}/record [post] 49// @Router /maps/{id}/record [post]
@@ -61,7 +73,7 @@ func CreateRecordWithDemo(c *gin.Context) {
61 isCoop = true 73 isCoop = true
62 } 74 }
63 // Get record request 75 // Get record request
64 var record models.RecordRequest 76 var record RecordRequest
65 if err := c.ShouldBind(&record); err != nil { 77 if err := c.ShouldBind(&record); err != nil {
66 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) 78 c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error()))
67 return 79 return
@@ -183,7 +195,7 @@ func CreateRecordWithDemo(c *gin.Context) {
183 c.JSON(http.StatusOK, models.Response{ 195 c.JSON(http.StatusOK, models.Response{
184 Success: true, 196 Success: true,
185 Message: "Successfully created record.", 197 Message: "Successfully created record.",
186 Data: models.RecordResponse{ScoreCount: hostDemoScoreCount, ScoreTime: hostDemoScoreTime}, 198 Data: RecordResponse{ScoreCount: hostDemoScoreCount, ScoreTime: hostDemoScoreTime},
187 }) 199 })
188} 200}
189 201
@@ -253,6 +265,7 @@ func serviceAccount() *http.Client {
253 return client 265 return client
254} 266}
255 267
268// Create Gdrive file
256func createFile(service *drive.Service, name string, mimeType string, content io.Reader, parentId string) (*drive.File, error) { 269func createFile(service *drive.Service, name string, mimeType string, content io.Reader, parentId string) (*drive.File, error) {
257 f := &drive.File{ 270 f := &drive.File{
258 MimeType: mimeType, 271 MimeType: mimeType,
@@ -269,6 +282,7 @@ func createFile(service *drive.Service, name string, mimeType string, content io
269 return file, nil 282 return file, nil
270} 283}
271 284
285// Delete Gdrive file
272func deleteFile(service *drive.Service, fileId string) { 286func deleteFile(service *drive.Service, fileId string) {
273 service.Files.Delete(fileId) 287 service.Files.Delete(fileId)
274} 288}
diff --git a/backend/controllers/userController.go b/backend/controllers/userController.go
index 6aa77fc..0dae155 100644
--- a/backend/controllers/userController.go
+++ b/backend/controllers/userController.go
@@ -11,6 +11,21 @@ import (
11 "github.com/pektezol/leastportalshub/backend/models" 11 "github.com/pektezol/leastportalshub/backend/models"
12) 12)
13 13
14type ProfileResponse struct {
15 Profile bool `json:"profile"`
16 SteamID string `json:"steam_id"`
17 UserName string `json:"user_name"`
18 AvatarLink string `json:"avatar_link"`
19 CountryCode string `json:"country_code"`
20 ScoresSP []ScoreResponse `json:"scores_sp"`
21 ScoresMP []ScoreResponse `json:"scores_mp"`
22}
23
24type ScoreResponse struct {
25 MapID int `json:"map_id"`
26 Records any `json:"records"`
27}
28
14// GET Profile 29// GET Profile
15// 30//
16// @Description Get profile page of session user. 31// @Description Get profile page of session user.
@@ -18,7 +33,7 @@ import (
18// @Accept json 33// @Accept json
19// @Produce json 34// @Produce json
20// @Param Authorization header string true "JWT Token" 35// @Param Authorization header string true "JWT Token"
21// @Success 200 {object} models.Response{data=models.ProfileResponse} 36// @Success 200 {object} models.Response{data=ProfileResponse}
22// @Failure 400 {object} models.Response 37// @Failure 400 {object} models.Response
23// @Failure 401 {object} models.Response 38// @Failure 401 {object} models.Response
24// @Router /profile [get] 39// @Router /profile [get]
@@ -30,7 +45,7 @@ func Profile(c *gin.Context) {
30 return 45 return
31 } 46 }
32 // Retrieve singleplayer records 47 // Retrieve singleplayer records
33 var scoresSP []models.ScoreResponse 48 var scoresSP []ScoreResponse
34 sql := `SELECT id, map_id, score_count, score_time, demo_id, record_date FROM records_sp WHERE user_id = $1 ORDER BY map_id` 49 sql := `SELECT id, map_id, score_count, score_time, demo_id, record_date FROM records_sp WHERE user_id = $1 ORDER BY map_id`
35 rows, err := database.DB.Query(sql, user.(models.User).SteamID) 50 rows, err := database.DB.Query(sql, user.(models.User).SteamID)
36 if err != nil { 51 if err != nil {
@@ -50,13 +65,13 @@ func Profile(c *gin.Context) {
50 // New map 65 // New map
51 recordsSP = []models.RecordSP{} 66 recordsSP = []models.RecordSP{}
52 recordsSP = append(recordsSP, record) 67 recordsSP = append(recordsSP, record)
53 scoresSP = append(scoresSP, models.ScoreResponse{ 68 scoresSP = append(scoresSP, ScoreResponse{
54 MapID: mapID, 69 MapID: mapID,
55 Records: recordsSP, 70 Records: recordsSP,
56 }) 71 })
57 } 72 }
58 // Retrieve multiplayer records 73 // Retrieve multiplayer records
59 var scoresMP []models.ScoreResponse 74 var scoresMP []ScoreResponse
60 sql = `SELECT id, map_id, host_id, partner_id, score_count, score_time, host_demo_id, partner_demo_id, record_date FROM records_mp 75 sql = `SELECT id, map_id, host_id, partner_id, score_count, score_time, host_demo_id, partner_demo_id, record_date FROM records_mp
61 WHERE host_id = $1 OR partner_id = $2 ORDER BY map_id` 76 WHERE host_id = $1 OR partner_id = $2 ORDER BY map_id`
62 rows, err = database.DB.Query(sql, user.(models.User).SteamID, user.(models.User).SteamID) 77 rows, err = database.DB.Query(sql, user.(models.User).SteamID, user.(models.User).SteamID)
@@ -77,7 +92,7 @@ func Profile(c *gin.Context) {
77 // New map 92 // New map
78 recordsMP = []models.RecordMP{} 93 recordsMP = []models.RecordMP{}
79 recordsMP = append(recordsMP, record) 94 recordsMP = append(recordsMP, record)
80 scoresMP = append(scoresMP, models.ScoreResponse{ 95 scoresMP = append(scoresMP, ScoreResponse{
81 MapID: mapID, 96 MapID: mapID,
82 Records: recordsMP, 97 Records: recordsMP,
83 }) 98 })
@@ -85,7 +100,7 @@ func Profile(c *gin.Context) {
85 c.JSON(http.StatusOK, models.Response{ 100 c.JSON(http.StatusOK, models.Response{
86 Success: true, 101 Success: true,
87 Message: "Successfully retrieved user scores.", 102 Message: "Successfully retrieved user scores.",
88 Data: models.ProfileResponse{ 103 Data: ProfileResponse{
89 Profile: true, 104 Profile: true,
90 SteamID: user.(models.User).SteamID, 105 SteamID: user.(models.User).SteamID,
91 UserName: user.(models.User).UserName, 106 UserName: user.(models.User).UserName,
@@ -105,7 +120,7 @@ func Profile(c *gin.Context) {
105// @Accept json 120// @Accept json
106// @Produce json 121// @Produce json
107// @Param id path int true "User ID" 122// @Param id path int true "User ID"
108// @Success 200 {object} models.Response{data=models.ProfileResponse} 123// @Success 200 {object} models.Response{data=ProfileResponse}
109// @Failure 400 {object} models.Response 124// @Failure 400 {object} models.Response
110// @Failure 404 {object} models.Response 125// @Failure 404 {object} models.Response
111// @Router /users/{id} [get] 126// @Router /users/{id} [get]
@@ -132,7 +147,7 @@ func FetchUser(c *gin.Context) {
132 return 147 return
133 } 148 }
134 // Retrieve singleplayer records 149 // Retrieve singleplayer records
135 var scoresSP []models.ScoreResponse 150 var scoresSP []ScoreResponse
136 sql := `SELECT id, map_id, score_count, score_time, demo_id, record_date FROM records_sp WHERE user_id = $1 ORDER BY map_id` 151 sql := `SELECT id, map_id, score_count, score_time, demo_id, record_date FROM records_sp WHERE user_id = $1 ORDER BY map_id`
137 rows, err := database.DB.Query(sql, user.SteamID) 152 rows, err := database.DB.Query(sql, user.SteamID)
138 if err != nil { 153 if err != nil {
@@ -152,13 +167,13 @@ func FetchUser(c *gin.Context) {
152 // New map 167 // New map
153 recordsSP = []models.RecordSP{} 168 recordsSP = []models.RecordSP{}
154 recordsSP = append(recordsSP, record) 169 recordsSP = append(recordsSP, record)
155 scoresSP = append(scoresSP, models.ScoreResponse{ 170 scoresSP = append(scoresSP, ScoreResponse{
156 MapID: mapID, 171 MapID: mapID,
157 Records: recordsSP, 172 Records: recordsSP,
158 }) 173 })
159 } 174 }
160 // Retrieve multiplayer records 175 // Retrieve multiplayer records
161 var scoresMP []models.ScoreResponse 176 var scoresMP []ScoreResponse
162 sql = `SELECT id, map_id, host_id, partner_id, score_count, score_time, host_demo_id, partner_demo_id, record_date FROM records_mp 177 sql = `SELECT id, map_id, host_id, partner_id, score_count, score_time, host_demo_id, partner_demo_id, record_date FROM records_mp
163 WHERE host_id = $1 OR partner_id = $2 ORDER BY map_id` 178 WHERE host_id = $1 OR partner_id = $2 ORDER BY map_id`
164 rows, err = database.DB.Query(sql, user.SteamID, user.SteamID) 179 rows, err = database.DB.Query(sql, user.SteamID, user.SteamID)
@@ -179,7 +194,7 @@ func FetchUser(c *gin.Context) {
179 // New map 194 // New map
180 recordsMP = []models.RecordMP{} 195 recordsMP = []models.RecordMP{}
181 recordsMP = append(recordsMP, record) 196 recordsMP = append(recordsMP, record)
182 scoresMP = append(scoresMP, models.ScoreResponse{ 197 scoresMP = append(scoresMP, ScoreResponse{
183 MapID: mapID, 198 MapID: mapID,
184 Records: recordsMP, 199 Records: recordsMP,
185 }) 200 })
@@ -187,7 +202,7 @@ func FetchUser(c *gin.Context) {
187 c.JSON(http.StatusOK, models.Response{ 202 c.JSON(http.StatusOK, models.Response{
188 Success: true, 203 Success: true,
189 Message: "Successfully retrieved user scores.", 204 Message: "Successfully retrieved user scores.",
190 Data: models.ProfileResponse{ 205 Data: ProfileResponse{
191 Profile: true, 206 Profile: true,
192 SteamID: user.SteamID, 207 SteamID: user.SteamID,
193 UserName: user.UserName, 208 UserName: user.UserName,
@@ -207,7 +222,7 @@ func FetchUser(c *gin.Context) {
207// @Accept json 222// @Accept json
208// @Produce json 223// @Produce json
209// @Param Authorization header string true "JWT Token" 224// @Param Authorization header string true "JWT Token"
210// @Success 200 {object} models.Response{data=models.ProfileResponse} 225// @Success 200 {object} models.Response{data=ProfileResponse}
211// @Failure 400 {object} models.Response 226// @Failure 400 {object} models.Response
212// @Failure 401 {object} models.Response 227// @Failure 401 {object} models.Response
213// @Router /profile [post] 228// @Router /profile [post]
@@ -233,7 +248,7 @@ func UpdateUser(c *gin.Context) {
233 c.JSON(http.StatusOK, models.Response{ 248 c.JSON(http.StatusOK, models.Response{
234 Success: true, 249 Success: true,
235 Message: "Successfully updated user.", 250 Message: "Successfully updated user.",
236 Data: models.ProfileResponse{ 251 Data: ProfileResponse{
237 Profile: true, 252 Profile: true,
238 SteamID: user.(models.User).SteamID, 253 SteamID: user.(models.User).SteamID,
239 UserName: profile.PersonaName, 254 UserName: profile.PersonaName,
diff --git a/backend/models/models.go b/backend/models/models.go
index 1231cb1..e21ba6a 100644
--- a/backend/models/models.go
+++ b/backend/models/models.go
@@ -4,6 +4,20 @@ import (
4 "time" 4 "time"
5) 5)
6 6
7type Response struct {
8 Success bool `json:"success"`
9 Message string `json:"message"`
10 Data any `json:"data"`
11}
12
13func ErrorResponse(message string) Response {
14 return Response{
15 Success: false,
16 Message: message,
17 Data: nil,
18 }
19}
20
7type User struct { 21type User struct {
8 SteamID string `json:"steam_id"` 22 SteamID string `json:"steam_id"`
9 UserName string `json:"user_name"` 23 UserName string `json:"user_name"`
diff --git a/backend/models/requests.go b/backend/models/requests.go
deleted file mode 100644
index 0113597..0000000
--- a/backend/models/requests.go
+++ /dev/null
@@ -1,39 +0,0 @@
1package models
2
3import (
4 "mime/multipart"
5 "time"
6)
7
8type CreateMapSummaryRequest struct {
9 CategoryID int `json:"category_id" binding:"required"`
10 Description string `json:"description" binding:"required"`
11 Showcase string `json:"showcase"`
12 UserName string `json:"user_name" binding:"required"`
13 ScoreCount *int `json:"score_count" binding:"required"`
14 RecordDate time.Time `json:"record_date" binding:"required"`
15}
16
17type EditMapSummaryRequest struct {
18 RouteID int `json:"route_id" binding:"required"`
19 Description string `json:"description" binding:"required"`
20 Showcase string `json:"showcase"`
21 UserName string `json:"user_name" binding:"required"`
22 ScoreCount *int `json:"score_count" binding:"required"`
23 RecordDate time.Time `json:"record_date" binding:"required"`
24}
25
26type DeleteMapSummaryRequest struct {
27 RouteID int `json:"route_id" binding:"required"`
28}
29
30type EditMapImageRequest struct {
31 Image string `json:"image" binding:"required"`
32}
33
34type RecordRequest struct {
35 HostDemo *multipart.FileHeader `json:"host_demo" form:"host_demo" binding:"required" swaggerignore:"true"`
36 PartnerDemo *multipart.FileHeader `json:"partner_demo" form:"partner_demo" swaggerignore:"true"`
37 IsPartnerOrange bool `json:"is_partner_orange" form:"is_partner_orange"`
38 PartnerID string `json:"partner_id" form:"partner_id"`
39}
diff --git a/backend/models/responses.go b/backend/models/responses.go
deleted file mode 100644
index 459911c..0000000
--- a/backend/models/responses.go
+++ /dev/null
@@ -1,64 +0,0 @@
1package models
2
3type Response struct {
4 Success bool `json:"success"`
5 Message string `json:"message"`
6 Data any `json:"data"`
7}
8
9type LoginResponse struct {
10 Token string `json:"token"`
11}
12
13type RankingsResponse struct {
14 RankingsSP []UserRanking `json:"rankings_sp"`
15 RankingsMP []UserRanking `json:"rankings_mp"`
16}
17
18type ProfileResponse struct {
19 Profile bool `json:"profile"`
20 SteamID string `json:"steam_id"`
21 UserName string `json:"user_name"`
22 AvatarLink string `json:"avatar_link"`
23 CountryCode string `json:"country_code"`
24 ScoresSP []ScoreResponse `json:"scores_sp"`
25 ScoresMP []ScoreResponse `json:"scores_mp"`
26}
27
28type ScoreResponse struct {
29 MapID int `json:"map_id"`
30 Records any `json:"records"`
31}
32
33type MapSummaryResponse struct {
34 Map Map `json:"map"`
35 Summary MapSummary `json:"summary"`
36}
37
38type SearchResponse struct {
39 Players []UserShort `json:"players"`
40 Maps []MapShort `json:"maps"`
41}
42
43type ChaptersResponse struct {
44 Game Game `json:"game"`
45 Chapters []Chapter `json:"chapters"`
46}
47
48type ChapterMapsResponse struct {
49 Chapter Chapter `json:"chapter"`
50 Maps []MapShort `json:"maps"`
51}
52
53type RecordResponse struct {
54 ScoreCount int `json:"score_count"`
55 ScoreTime int `json:"score_time"`
56}
57
58func ErrorResponse(message string) Response {
59 return Response{
60 Success: false,
61 Message: message,
62 Data: nil,
63 }
64}
diff --git a/docs/docs.go b/docs/docs.go
index 423afad..df01379 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -50,7 +50,7 @@ const docTemplate = `{
50 "type": "object", 50 "type": "object",
51 "properties": { 51 "properties": {
52 "data": { 52 "data": {
53 "$ref": "#/definitions/models.ChapterMapsResponse" 53 "$ref": "#/definitions/controllers.ChapterMapsResponse"
54 } 54 }
55 } 55 }
56 } 56 }
@@ -173,7 +173,7 @@ const docTemplate = `{
173 "type": "object", 173 "type": "object",
174 "properties": { 174 "properties": {
175 "data": { 175 "data": {
176 "$ref": "#/definitions/models.ChaptersResponse" 176 "$ref": "#/definitions/controllers.ChaptersResponse"
177 } 177 }
178 } 178 }
179 } 179 }
@@ -213,7 +213,7 @@ const docTemplate = `{
213 "type": "object", 213 "type": "object",
214 "properties": { 214 "properties": {
215 "data": { 215 "data": {
216 "$ref": "#/definitions/models.LoginResponse" 216 "$ref": "#/definitions/controllers.LoginResponse"
217 } 217 }
218 } 218 }
219 } 219 }
@@ -259,7 +259,7 @@ const docTemplate = `{
259 "in": "body", 259 "in": "body",
260 "required": true, 260 "required": true,
261 "schema": { 261 "schema": {
262 "$ref": "#/definitions/models.EditMapImageRequest" 262 "$ref": "#/definitions/controllers.EditMapImageRequest"
263 } 263 }
264 } 264 }
265 ], 265 ],
@@ -275,7 +275,7 @@ const docTemplate = `{
275 "type": "object", 275 "type": "object",
276 "properties": { 276 "properties": {
277 "data": { 277 "data": {
278 "$ref": "#/definitions/models.EditMapImageRequest" 278 "$ref": "#/definitions/controllers.EditMapImageRequest"
279 } 279 }
280 } 280 }
281 } 281 }
@@ -414,7 +414,7 @@ const docTemplate = `{
414 "type": "object", 414 "type": "object",
415 "properties": { 415 "properties": {
416 "data": { 416 "data": {
417 "$ref": "#/definitions/models.RecordResponse" 417 "$ref": "#/definitions/controllers.RecordResponse"
418 } 418 }
419 } 419 }
420 } 420 }
@@ -466,7 +466,7 @@ const docTemplate = `{
466 "type": "object", 466 "type": "object",
467 "properties": { 467 "properties": {
468 "data": { 468 "data": {
469 "$ref": "#/definitions/models.MapSummaryResponse" 469 "$ref": "#/definitions/controllers.MapSummaryResponse"
470 } 470 }
471 } 471 }
472 } 472 }
@@ -510,7 +510,7 @@ const docTemplate = `{
510 "in": "body", 510 "in": "body",
511 "required": true, 511 "required": true,
512 "schema": { 512 "schema": {
513 "$ref": "#/definitions/models.EditMapSummaryRequest" 513 "$ref": "#/definitions/controllers.EditMapSummaryRequest"
514 } 514 }
515 } 515 }
516 ], 516 ],
@@ -526,7 +526,7 @@ const docTemplate = `{
526 "type": "object", 526 "type": "object",
527 "properties": { 527 "properties": {
528 "data": { 528 "data": {
529 "$ref": "#/definitions/models.EditMapSummaryRequest" 529 "$ref": "#/definitions/controllers.EditMapSummaryRequest"
530 } 530 }
531 } 531 }
532 } 532 }
@@ -570,7 +570,7 @@ const docTemplate = `{
570 "in": "body", 570 "in": "body",
571 "required": true, 571 "required": true,
572 "schema": { 572 "schema": {
573 "$ref": "#/definitions/models.CreateMapSummaryRequest" 573 "$ref": "#/definitions/controllers.CreateMapSummaryRequest"
574 } 574 }
575 } 575 }
576 ], 576 ],
@@ -586,7 +586,7 @@ const docTemplate = `{
586 "type": "object", 586 "type": "object",
587 "properties": { 587 "properties": {
588 "data": { 588 "data": {
589 "$ref": "#/definitions/models.CreateMapSummaryRequest" 589 "$ref": "#/definitions/controllers.CreateMapSummaryRequest"
590 } 590 }
591 } 591 }
592 } 592 }
@@ -630,7 +630,7 @@ const docTemplate = `{
630 "in": "body", 630 "in": "body",
631 "required": true, 631 "required": true,
632 "schema": { 632 "schema": {
633 "$ref": "#/definitions/models.DeleteMapSummaryRequest" 633 "$ref": "#/definitions/controllers.DeleteMapSummaryRequest"
634 } 634 }
635 } 635 }
636 ], 636 ],
@@ -646,7 +646,7 @@ const docTemplate = `{
646 "type": "object", 646 "type": "object",
647 "properties": { 647 "properties": {
648 "data": { 648 "data": {
649 "$ref": "#/definitions/models.DeleteMapSummaryRequest" 649 "$ref": "#/definitions/controllers.DeleteMapSummaryRequest"
650 } 650 }
651 } 651 }
652 } 652 }
@@ -695,7 +695,7 @@ const docTemplate = `{
695 "type": "object", 695 "type": "object",
696 "properties": { 696 "properties": {
697 "data": { 697 "data": {
698 "$ref": "#/definitions/models.ProfileResponse" 698 "$ref": "#/definitions/controllers.ProfileResponse"
699 } 699 }
700 } 700 }
701 } 701 }
@@ -796,7 +796,7 @@ const docTemplate = `{
796 "type": "object", 796 "type": "object",
797 "properties": { 797 "properties": {
798 "data": { 798 "data": {
799 "$ref": "#/definitions/models.ProfileResponse" 799 "$ref": "#/definitions/controllers.ProfileResponse"
800 } 800 }
801 } 801 }
802 } 802 }
@@ -839,7 +839,7 @@ const docTemplate = `{
839 "type": "object", 839 "type": "object",
840 "properties": { 840 "properties": {
841 "data": { 841 "data": {
842 "$ref": "#/definitions/models.RankingsResponse" 842 "$ref": "#/definitions/controllers.RankingsResponse"
843 } 843 }
844 } 844 }
845 } 845 }
@@ -884,7 +884,7 @@ const docTemplate = `{
884 "type": "object", 884 "type": "object",
885 "properties": { 885 "properties": {
886 "data": { 886 "data": {
887 "$ref": "#/definitions/models.SearchResponse" 887 "$ref": "#/definitions/controllers.SearchResponse"
888 } 888 }
889 } 889 }
890 } 890 }
@@ -921,7 +921,7 @@ const docTemplate = `{
921 "type": "object", 921 "type": "object",
922 "properties": { 922 "properties": {
923 "data": { 923 "data": {
924 "$ref": "#/definitions/models.LoginResponse" 924 "$ref": "#/definitions/controllers.LoginResponse"
925 } 925 }
926 } 926 }
927 } 927 }
@@ -956,7 +956,7 @@ const docTemplate = `{
956 "type": "object", 956 "type": "object",
957 "properties": { 957 "properties": {
958 "data": { 958 "data": {
959 "$ref": "#/definitions/models.LoginResponse" 959 "$ref": "#/definitions/controllers.LoginResponse"
960 } 960 }
961 } 961 }
962 } 962 }
@@ -1005,7 +1005,7 @@ const docTemplate = `{
1005 "type": "object", 1005 "type": "object",
1006 "properties": { 1006 "properties": {
1007 "data": { 1007 "data": {
1008 "$ref": "#/definitions/models.ProfileResponse" 1008 "$ref": "#/definitions/controllers.ProfileResponse"
1009 } 1009 }
1010 } 1010 }
1011 } 1011 }
@@ -1029,29 +1029,7 @@ const docTemplate = `{
1029 } 1029 }
1030 }, 1030 },
1031 "definitions": { 1031 "definitions": {
1032 "models.Category": { 1032 "controllers.ChapterMapsResponse": {
1033 "type": "object",
1034 "properties": {
1035 "id": {
1036 "type": "integer"
1037 },
1038 "name": {
1039 "type": "string"
1040 }
1041 }
1042 },
1043 "models.Chapter": {
1044 "type": "object",
1045 "properties": {
1046 "id": {
1047 "type": "integer"
1048 },
1049 "name": {
1050 "type": "string"
1051 }
1052 }
1053 },
1054 "models.ChapterMapsResponse": {
1055 "type": "object", 1033 "type": "object",
1056 "properties": { 1034 "properties": {
1057 "chapter": { 1035 "chapter": {
@@ -1065,7 +1043,7 @@ const docTemplate = `{
1065 } 1043 }
1066 } 1044 }
1067 }, 1045 },
1068 "models.ChaptersResponse": { 1046 "controllers.ChaptersResponse": {
1069 "type": "object", 1047 "type": "object",
1070 "properties": { 1048 "properties": {
1071 "chapters": { 1049 "chapters": {
@@ -1079,7 +1057,7 @@ const docTemplate = `{
1079 } 1057 }
1080 } 1058 }
1081 }, 1059 },
1082 "models.CreateMapSummaryRequest": { 1060 "controllers.CreateMapSummaryRequest": {
1083 "type": "object", 1061 "type": "object",
1084 "required": [ 1062 "required": [
1085 "category_id", 1063 "category_id",
@@ -1109,7 +1087,7 @@ const docTemplate = `{
1109 } 1087 }
1110 } 1088 }
1111 }, 1089 },
1112 "models.DeleteMapSummaryRequest": { 1090 "controllers.DeleteMapSummaryRequest": {
1113 "type": "object", 1091 "type": "object",
1114 "required": [ 1092 "required": [
1115 "route_id" 1093 "route_id"
@@ -1120,7 +1098,7 @@ const docTemplate = `{
1120 } 1098 }
1121 } 1099 }
1122 }, 1100 },
1123 "models.EditMapImageRequest": { 1101 "controllers.EditMapImageRequest": {
1124 "type": "object", 1102 "type": "object",
1125 "required": [ 1103 "required": [
1126 "image" 1104 "image"
@@ -1131,7 +1109,7 @@ const docTemplate = `{
1131 } 1109 }
1132 } 1110 }
1133 }, 1111 },
1134 "models.EditMapSummaryRequest": { 1112 "controllers.EditMapSummaryRequest": {
1135 "type": "object", 1113 "type": "object",
1136 "required": [ 1114 "required": [
1137 "description", 1115 "description",
@@ -1161,24 +1139,143 @@ const docTemplate = `{
1161 } 1139 }
1162 } 1140 }
1163 }, 1141 },
1164 "models.Game": { 1142 "controllers.LoginResponse": {
1143 "type": "object",
1144 "properties": {
1145 "token": {
1146 "type": "string"
1147 }
1148 }
1149 },
1150 "controllers.MapSummaryResponse": {
1151 "type": "object",
1152 "properties": {
1153 "map": {
1154 "$ref": "#/definitions/models.Map"
1155 },
1156 "summary": {
1157 "$ref": "#/definitions/models.MapSummary"
1158 }
1159 }
1160 },
1161 "controllers.ProfileResponse": {
1162 "type": "object",
1163 "properties": {
1164 "avatar_link": {
1165 "type": "string"
1166 },
1167 "country_code": {
1168 "type": "string"
1169 },
1170 "profile": {
1171 "type": "boolean"
1172 },
1173 "scores_mp": {
1174 "type": "array",
1175 "items": {
1176 "$ref": "#/definitions/controllers.ScoreResponse"
1177 }
1178 },
1179 "scores_sp": {
1180 "type": "array",
1181 "items": {
1182 "$ref": "#/definitions/controllers.ScoreResponse"
1183 }
1184 },
1185 "steam_id": {
1186 "type": "string"
1187 },
1188 "user_name": {
1189 "type": "string"
1190 }
1191 }
1192 },
1193 "controllers.RankingsResponse": {
1194 "type": "object",
1195 "properties": {
1196 "rankings_mp": {
1197 "type": "array",
1198 "items": {
1199 "$ref": "#/definitions/models.UserRanking"
1200 }
1201 },
1202 "rankings_sp": {
1203 "type": "array",
1204 "items": {
1205 "$ref": "#/definitions/models.UserRanking"
1206 }
1207 }
1208 }
1209 },
1210 "controllers.RecordResponse": {
1211 "type": "object",
1212 "properties": {
1213 "score_count": {
1214 "type": "integer"
1215 },
1216 "score_time": {
1217 "type": "integer"
1218 }
1219 }
1220 },
1221 "controllers.ScoreResponse": {
1222 "type": "object",
1223 "properties": {
1224 "map_id": {
1225 "type": "integer"
1226 },
1227 "records": {}
1228 }
1229 },
1230 "controllers.SearchResponse": {
1231 "type": "object",
1232 "properties": {
1233 "maps": {
1234 "type": "array",
1235 "items": {
1236 "$ref": "#/definitions/models.MapShort"
1237 }
1238 },
1239 "players": {
1240 "type": "array",
1241 "items": {
1242 "$ref": "#/definitions/models.UserShort"
1243 }
1244 }
1245 }
1246 },
1247 "models.Category": {
1165 "type": "object", 1248 "type": "object",
1166 "properties": { 1249 "properties": {
1167 "id": { 1250 "id": {
1168 "type": "integer" 1251 "type": "integer"
1169 }, 1252 },
1170 "is_coop": { 1253 "name": {
1171 "type": "boolean" 1254 "type": "string"
1255 }
1256 }
1257 },
1258 "models.Chapter": {
1259 "type": "object",
1260 "properties": {
1261 "id": {
1262 "type": "integer"
1172 }, 1263 },
1173 "name": { 1264 "name": {
1174 "type": "string" 1265 "type": "string"
1175 } 1266 }
1176 } 1267 }
1177 }, 1268 },
1178 "models.LoginResponse": { 1269 "models.Game": {
1179 "type": "object", 1270 "type": "object",
1180 "properties": { 1271 "properties": {
1181 "token": { 1272 "id": {
1273 "type": "integer"
1274 },
1275 "is_coop": {
1276 "type": "boolean"
1277 },
1278 "name": {
1182 "type": "string" 1279 "type": "string"
1183 } 1280 }
1184 } 1281 }
@@ -1271,77 +1368,6 @@ const docTemplate = `{
1271 } 1368 }
1272 } 1369 }
1273 }, 1370 },
1274 "models.MapSummaryResponse": {
1275 "type": "object",
1276 "properties": {
1277 "map": {
1278 "$ref": "#/definitions/models.Map"
1279 },
1280 "summary": {
1281 "$ref": "#/definitions/models.MapSummary"
1282 }
1283 }
1284 },
1285 "models.ProfileResponse": {
1286 "type": "object",
1287 "properties": {
1288 "avatar_link": {
1289 "type": "string"
1290 },
1291 "country_code": {
1292 "type": "string"
1293 },
1294 "profile": {
1295 "type": "boolean"
1296 },
1297 "scores_mp": {
1298 "type": "array",
1299 "items": {
1300 "$ref": "#/definitions/models.ScoreResponse"
1301 }
1302 },
1303 "scores_sp": {
1304 "type": "array",
1305 "items": {
1306 "$ref": "#/definitions/models.ScoreResponse"
1307 }
1308 },
1309 "steam_id": {
1310 "type": "string"
1311 },
1312 "user_name": {
1313 "type": "string"
1314 }
1315 }
1316 },
1317 "models.RankingsResponse": {
1318 "type": "object",
1319 "properties": {
1320 "rankings_mp": {
1321 "type": "array",
1322 "items": {
1323 "$ref": "#/definitions/models.UserRanking"
1324 }
1325 },
1326 "rankings_sp": {
1327 "type": "array",
1328 "items": {
1329 "$ref": "#/definitions/models.UserRanking"
1330 }
1331 }
1332 }
1333 },
1334 "models.RecordResponse": {
1335 "type": "object",
1336 "properties": {
1337 "score_count": {
1338 "type": "integer"
1339 },
1340 "score_time": {
1341 "type": "integer"
1342 }
1343 }
1344 },
1345 "models.Response": { 1371 "models.Response": {
1346 "type": "object", 1372 "type": "object",
1347 "properties": { 1373 "properties": {
@@ -1354,32 +1380,6 @@ const docTemplate = `{
1354 } 1380 }
1355 } 1381 }
1356 }, 1382 },
1357 "models.ScoreResponse": {
1358 "type": "object",
1359 "properties": {
1360 "map_id": {
1361 "type": "integer"
1362 },
1363 "records": {}
1364 }
1365 },
1366 "models.SearchResponse": {
1367 "type": "object",
1368 "properties": {
1369 "maps": {
1370 "type": "array",
1371 "items": {
1372 "$ref": "#/definitions/models.MapShort"
1373 }
1374 },
1375 "players": {
1376 "type": "array",
1377 "items": {
1378 "$ref": "#/definitions/models.UserShort"
1379 }
1380 }
1381 }
1382 },
1383 "models.UserRanking": { 1383 "models.UserRanking": {
1384 "type": "object", 1384 "type": "object",
1385 "properties": { 1385 "properties": {
diff --git a/docs/swagger.json b/docs/swagger.json
index 2e1a789..0f3dade 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -43,7 +43,7 @@
43 "type": "object", 43 "type": "object",
44 "properties": { 44 "properties": {
45 "data": { 45 "data": {
46 "$ref": "#/definitions/models.ChapterMapsResponse" 46 "$ref": "#/definitions/controllers.ChapterMapsResponse"
47 } 47 }
48 } 48 }
49 } 49 }
@@ -166,7 +166,7 @@
166 "type": "object", 166 "type": "object",
167 "properties": { 167 "properties": {
168 "data": { 168 "data": {
169 "$ref": "#/definitions/models.ChaptersResponse" 169 "$ref": "#/definitions/controllers.ChaptersResponse"
170 } 170 }
171 } 171 }
172 } 172 }
@@ -206,7 +206,7 @@
206 "type": "object", 206 "type": "object",
207 "properties": { 207 "properties": {
208 "data": { 208 "data": {
209 "$ref": "#/definitions/models.LoginResponse" 209 "$ref": "#/definitions/controllers.LoginResponse"
210 } 210 }
211 } 211 }
212 } 212 }
@@ -252,7 +252,7 @@
252 "in": "body", 252 "in": "body",
253 "required": true, 253 "required": true,
254 "schema": { 254 "schema": {
255 "$ref": "#/definitions/models.EditMapImageRequest" 255 "$ref": "#/definitions/controllers.EditMapImageRequest"
256 } 256 }
257 } 257 }
258 ], 258 ],
@@ -268,7 +268,7 @@
268 "type": "object", 268 "type": "object",
269 "properties": { 269 "properties": {
270 "data": { 270 "data": {
271 "$ref": "#/definitions/models.EditMapImageRequest" 271 "$ref": "#/definitions/controllers.EditMapImageRequest"
272 } 272 }
273 } 273 }
274 } 274 }
@@ -407,7 +407,7 @@
407 "type": "object", 407 "type": "object",
408 "properties": { 408 "properties": {
409 "data": { 409 "data": {
410 "$ref": "#/definitions/models.RecordResponse" 410 "$ref": "#/definitions/controllers.RecordResponse"
411 } 411 }
412 } 412 }
413 } 413 }
@@ -459,7 +459,7 @@
459 "type": "object", 459 "type": "object",
460 "properties": { 460 "properties": {
461 "data": { 461 "data": {
462 "$ref": "#/definitions/models.MapSummaryResponse" 462 "$ref": "#/definitions/controllers.MapSummaryResponse"
463 } 463 }
464 } 464 }
465 } 465 }
@@ -503,7 +503,7 @@
503 "in": "body", 503 "in": "body",
504 "required": true, 504 "required": true,
505 "schema": { 505 "schema": {
506 "$ref": "#/definitions/models.EditMapSummaryRequest" 506 "$ref": "#/definitions/controllers.EditMapSummaryRequest"
507 } 507 }
508 } 508 }
509 ], 509 ],
@@ -519,7 +519,7 @@
519 "type": "object", 519 "type": "object",
520 "properties": { 520 "properties": {
521 "data": { 521 "data": {
522 "$ref": "#/definitions/models.EditMapSummaryRequest" 522 "$ref": "#/definitions/controllers.EditMapSummaryRequest"
523 } 523 }
524 } 524 }
525 } 525 }
@@ -563,7 +563,7 @@
563 "in": "body", 563 "in": "body",
564 "required": true, 564 "required": true,
565 "schema": { 565 "schema": {
566 "$ref": "#/definitions/models.CreateMapSummaryRequest" 566 "$ref": "#/definitions/controllers.CreateMapSummaryRequest"
567 } 567 }
568 } 568 }
569 ], 569 ],
@@ -579,7 +579,7 @@
579 "type": "object", 579 "type": "object",
580 "properties": { 580 "properties": {
581 "data": { 581 "data": {
582 "$ref": "#/definitions/models.CreateMapSummaryRequest" 582 "$ref": "#/definitions/controllers.CreateMapSummaryRequest"
583 } 583 }
584 } 584 }
585 } 585 }
@@ -623,7 +623,7 @@
623 "in": "body", 623 "in": "body",
624 "required": true, 624 "required": true,
625 "schema": { 625 "schema": {
626 "$ref": "#/definitions/models.DeleteMapSummaryRequest" 626 "$ref": "#/definitions/controllers.DeleteMapSummaryRequest"
627 } 627 }
628 } 628 }
629 ], 629 ],
@@ -639,7 +639,7 @@
639 "type": "object", 639 "type": "object",
640 "properties": { 640 "properties": {
641 "data": { 641 "data": {
642 "$ref": "#/definitions/models.DeleteMapSummaryRequest" 642 "$ref": "#/definitions/controllers.DeleteMapSummaryRequest"
643 } 643 }
644 } 644 }
645 } 645 }
@@ -688,7 +688,7 @@
688 "type": "object", 688 "type": "object",
689 "properties": { 689 "properties": {
690 "data": { 690 "data": {
691 "$ref": "#/definitions/models.ProfileResponse" 691 "$ref": "#/definitions/controllers.ProfileResponse"
692 } 692 }
693 } 693 }
694 } 694 }
@@ -789,7 +789,7 @@
789 "type": "object", 789 "type": "object",
790 "properties": { 790 "properties": {
791 "data": { 791 "data": {
792 "$ref": "#/definitions/models.ProfileResponse" 792 "$ref": "#/definitions/controllers.ProfileResponse"
793 } 793 }
794 } 794 }
795 } 795 }
@@ -832,7 +832,7 @@
832 "type": "object", 832 "type": "object",
833 "properties": { 833 "properties": {
834 "data": { 834 "data": {
835 "$ref": "#/definitions/models.RankingsResponse" 835 "$ref": "#/definitions/controllers.RankingsResponse"
836 } 836 }
837 } 837 }
838 } 838 }
@@ -877,7 +877,7 @@
877 "type": "object", 877 "type": "object",
878 "properties": { 878 "properties": {
879 "data": { 879 "data": {
880 "$ref": "#/definitions/models.SearchResponse" 880 "$ref": "#/definitions/controllers.SearchResponse"
881 } 881 }
882 } 882 }
883 } 883 }
@@ -914,7 +914,7 @@
914 "type": "object", 914 "type": "object",
915 "properties": { 915 "properties": {
916 "data": { 916 "data": {
917 "$ref": "#/definitions/models.LoginResponse" 917 "$ref": "#/definitions/controllers.LoginResponse"
918 } 918 }
919 } 919 }
920 } 920 }
@@ -949,7 +949,7 @@
949 "type": "object", 949 "type": "object",
950 "properties": { 950 "properties": {
951 "data": { 951 "data": {
952 "$ref": "#/definitions/models.LoginResponse" 952 "$ref": "#/definitions/controllers.LoginResponse"
953 } 953 }
954 } 954 }
955 } 955 }
@@ -998,7 +998,7 @@
998 "type": "object", 998 "type": "object",
999 "properties": { 999 "properties": {
1000 "data": { 1000 "data": {
1001 "$ref": "#/definitions/models.ProfileResponse" 1001 "$ref": "#/definitions/controllers.ProfileResponse"
1002 } 1002 }
1003 } 1003 }
1004 } 1004 }
@@ -1022,29 +1022,7 @@
1022 } 1022 }
1023 }, 1023 },
1024 "definitions": { 1024 "definitions": {
1025 "models.Category": { 1025 "controllers.ChapterMapsResponse": {
1026 "type": "object",
1027 "properties": {
1028 "id": {
1029 "type": "integer"
1030 },
1031 "name": {
1032 "type": "string"
1033 }
1034 }
1035 },
1036 "models.Chapter": {
1037 "type": "object",
1038 "properties": {
1039 "id": {
1040 "type": "integer"
1041 },
1042 "name": {
1043 "type": "string"
1044 }
1045 }
1046 },
1047 "models.ChapterMapsResponse": {
1048 "type": "object", 1026 "type": "object",
1049 "properties": { 1027 "properties": {
1050 "chapter": { 1028 "chapter": {
@@ -1058,7 +1036,7 @@
1058 } 1036 }
1059 } 1037 }
1060 }, 1038 },
1061 "models.ChaptersResponse": { 1039 "controllers.ChaptersResponse": {
1062 "type": "object", 1040 "type": "object",
1063 "properties": { 1041 "properties": {
1064 "chapters": { 1042 "chapters": {
@@ -1072,7 +1050,7 @@
1072 } 1050 }
1073 } 1051 }
1074 }, 1052 },
1075 "models.CreateMapSummaryRequest": { 1053 "controllers.CreateMapSummaryRequest": {
1076 "type": "object", 1054 "type": "object",
1077 "required": [ 1055 "required": [
1078 "category_id", 1056 "category_id",
@@ -1102,7 +1080,7 @@
1102 } 1080 }
1103 } 1081 }
1104 }, 1082 },
1105 "models.DeleteMapSummaryRequest": { 1083 "controllers.DeleteMapSummaryRequest": {
1106 "type": "object", 1084 "type": "object",
1107 "required": [ 1085 "required": [
1108 "route_id" 1086 "route_id"
@@ -1113,7 +1091,7 @@
1113 } 1091 }
1114 } 1092 }
1115 }, 1093 },
1116 "models.EditMapImageRequest": { 1094 "controllers.EditMapImageRequest": {
1117 "type": "object", 1095 "type": "object",
1118 "required": [ 1096 "required": [
1119 "image" 1097 "image"
@@ -1124,7 +1102,7 @@
1124 } 1102 }
1125 } 1103 }
1126 }, 1104 },
1127 "models.EditMapSummaryRequest": { 1105 "controllers.EditMapSummaryRequest": {
1128 "type": "object", 1106 "type": "object",
1129 "required": [ 1107 "required": [
1130 "description", 1108 "description",
@@ -1154,24 +1132,143 @@
1154 } 1132 }
1155 } 1133 }
1156 }, 1134 },
1157 "models.Game": { 1135 "controllers.LoginResponse": {
1136 "type": "object",
1137 "properties": {
1138 "token": {
1139 "type": "string"
1140 }
1141 }
1142 },
1143 "controllers.MapSummaryResponse": {
1144 "type": "object",
1145 "properties": {
1146 "map": {
1147 "$ref": "#/definitions/models.Map"
1148 },
1149 "summary": {
1150 "$ref": "#/definitions/models.MapSummary"
1151 }
1152 }
1153 },
1154 "controllers.ProfileResponse": {
1155 "type": "object",
1156 "properties": {
1157 "avatar_link": {
1158 "type": "string"
1159 },
1160 "country_code": {
1161 "type": "string"
1162 },
1163 "profile": {
1164 "type": "boolean"
1165 },
1166 "scores_mp": {
1167 "type": "array",
1168 "items": {
1169 "$ref": "#/definitions/controllers.ScoreResponse"
1170 }
1171 },
1172 "scores_sp": {
1173 "type": "array",
1174 "items": {
1175 "$ref": "#/definitions/controllers.ScoreResponse"
1176 }
1177 },
1178 "steam_id": {
1179 "type": "string"
1180 },
1181 "user_name": {
1182 "type": "string"
1183 }
1184 }
1185 },
1186 "controllers.RankingsResponse": {
1187 "type": "object",
1188 "properties": {
1189 "rankings_mp": {
1190 "type": "array",
1191 "items": {
1192 "$ref": "#/definitions/models.UserRanking"
1193 }
1194 },
1195 "rankings_sp": {
1196 "type": "array",
1197 "items": {
1198 "$ref": "#/definitions/models.UserRanking"
1199 }
1200 }
1201 }
1202 },
1203 "controllers.RecordResponse": {
1204 "type": "object",
1205 "properties": {
1206 "score_count": {
1207 "type": "integer"
1208 },
1209 "score_time": {
1210 "type": "integer"
1211 }
1212 }
1213 },
1214 "controllers.ScoreResponse": {
1215 "type": "object",
1216 "properties": {
1217 "map_id": {
1218 "type": "integer"
1219 },
1220 "records": {}
1221 }
1222 },
1223 "controllers.SearchResponse": {
1224 "type": "object",
1225 "properties": {
1226 "maps": {
1227 "type": "array",
1228 "items": {
1229 "$ref": "#/definitions/models.MapShort"
1230 }
1231 },
1232 "players": {
1233 "type": "array",
1234 "items": {
1235 "$ref": "#/definitions/models.UserShort"
1236 }
1237 }
1238 }
1239 },
1240 "models.Category": {
1158 "type": "object", 1241 "type": "object",
1159 "properties": { 1242 "properties": {
1160 "id": { 1243 "id": {
1161 "type": "integer" 1244 "type": "integer"
1162 }, 1245 },
1163 "is_coop": { 1246 "name": {
1164 "type": "boolean" 1247 "type": "string"
1248 }
1249 }
1250 },
1251 "models.Chapter": {
1252 "type": "object",
1253 "properties": {
1254 "id": {
1255 "type": "integer"
1165 }, 1256 },
1166 "name": { 1257 "name": {
1167 "type": "string" 1258 "type": "string"
1168 } 1259 }
1169 } 1260 }
1170 }, 1261 },
1171 "models.LoginResponse": { 1262 "models.Game": {
1172 "type": "object", 1263 "type": "object",
1173 "properties": { 1264 "properties": {
1174 "token": { 1265 "id": {
1266 "type": "integer"
1267 },
1268 "is_coop": {
1269 "type": "boolean"
1270 },
1271 "name": {
1175 "type": "string" 1272 "type": "string"
1176 } 1273 }
1177 } 1274 }
@@ -1264,77 +1361,6 @@
1264 } 1361 }
1265 } 1362 }
1266 }, 1363 },
1267 "models.MapSummaryResponse": {
1268 "type": "object",
1269 "properties": {
1270 "map": {
1271 "$ref": "#/definitions/models.Map"
1272 },
1273 "summary": {
1274 "$ref": "#/definitions/models.MapSummary"
1275 }
1276 }
1277 },
1278 "models.ProfileResponse": {
1279 "type": "object",
1280 "properties": {
1281 "avatar_link": {
1282 "type": "string"
1283 },
1284 "country_code": {
1285 "type": "string"
1286 },
1287 "profile": {
1288 "type": "boolean"
1289 },
1290 "scores_mp": {
1291 "type": "array",
1292 "items": {
1293 "$ref": "#/definitions/models.ScoreResponse"
1294 }
1295 },
1296 "scores_sp": {
1297 "type": "array",
1298 "items": {
1299 "$ref": "#/definitions/models.ScoreResponse"
1300 }
1301 },
1302 "steam_id": {
1303 "type": "string"
1304 },
1305 "user_name": {
1306 "type": "string"
1307 }
1308 }
1309 },
1310 "models.RankingsResponse": {
1311 "type": "object",
1312 "properties": {
1313 "rankings_mp": {
1314 "type": "array",
1315 "items": {
1316 "$ref": "#/definitions/models.UserRanking"
1317 }
1318 },
1319 "rankings_sp": {
1320 "type": "array",
1321 "items": {
1322 "$ref": "#/definitions/models.UserRanking"
1323 }
1324 }
1325 }
1326 },
1327 "models.RecordResponse": {
1328 "type": "object",
1329 "properties": {
1330 "score_count": {
1331 "type": "integer"
1332 },
1333 "score_time": {
1334 "type": "integer"
1335 }
1336 }
1337 },
1338 "models.Response": { 1364 "models.Response": {
1339 "type": "object", 1365 "type": "object",
1340 "properties": { 1366 "properties": {
@@ -1347,32 +1373,6 @@
1347 } 1373 }
1348 } 1374 }
1349 }, 1375 },
1350 "models.ScoreResponse": {
1351 "type": "object",
1352 "properties": {
1353 "map_id": {
1354 "type": "integer"
1355 },
1356 "records": {}
1357 }
1358 },
1359 "models.SearchResponse": {
1360 "type": "object",
1361 "properties": {
1362 "maps": {
1363 "type": "array",
1364 "items": {
1365 "$ref": "#/definitions/models.MapShort"
1366 }
1367 },
1368 "players": {
1369 "type": "array",
1370 "items": {
1371 "$ref": "#/definitions/models.UserShort"
1372 }
1373 }
1374 }
1375 },
1376 "models.UserRanking": { 1376 "models.UserRanking": {
1377 "type": "object", 1377 "type": "object",
1378 "properties": { 1378 "properties": {
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index 7571073..f50fecb 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -1,20 +1,6 @@
1basePath: /v1 1basePath: /v1
2definitions: 2definitions:
3 models.Category: 3 controllers.ChapterMapsResponse:
4 properties:
5 id:
6 type: integer
7 name:
8 type: string
9 type: object
10 models.Chapter:
11 properties:
12 id:
13 type: integer
14 name:
15 type: string
16 type: object
17 models.ChapterMapsResponse:
18 properties: 4 properties:
19 chapter: 5 chapter:
20 $ref: '#/definitions/models.Chapter' 6 $ref: '#/definitions/models.Chapter'
@@ -23,7 +9,7 @@ definitions:
23 $ref: '#/definitions/models.MapShort' 9 $ref: '#/definitions/models.MapShort'
24 type: array 10 type: array
25 type: object 11 type: object
26 models.ChaptersResponse: 12 controllers.ChaptersResponse:
27 properties: 13 properties:
28 chapters: 14 chapters:
29 items: 15 items:
@@ -32,7 +18,7 @@ definitions:
32 game: 18 game:
33 $ref: '#/definitions/models.Game' 19 $ref: '#/definitions/models.Game'
34 type: object 20 type: object
35 models.CreateMapSummaryRequest: 21 controllers.CreateMapSummaryRequest:
36 properties: 22 properties:
37 category_id: 23 category_id:
38 type: integer 24 type: integer
@@ -53,21 +39,21 @@ definitions:
53 - score_count 39 - score_count
54 - user_name 40 - user_name
55 type: object 41 type: object
56 models.DeleteMapSummaryRequest: 42 controllers.DeleteMapSummaryRequest:
57 properties: 43 properties:
58 route_id: 44 route_id:
59 type: integer 45 type: integer
60 required: 46 required:
61 - route_id 47 - route_id
62 type: object 48 type: object
63 models.EditMapImageRequest: 49 controllers.EditMapImageRequest:
64 properties: 50 properties:
65 image: 51 image:
66 type: string 52 type: string
67 required: 53 required:
68 - image 54 - image
69 type: object 55 type: object
70 models.EditMapSummaryRequest: 56 controllers.EditMapSummaryRequest:
71 properties: 57 properties:
72 description: 58 description:
73 type: string 59 type: string
@@ -88,18 +74,95 @@ definitions:
88 - score_count 74 - score_count
89 - user_name 75 - user_name
90 type: object 76 type: object
91 models.Game: 77 controllers.LoginResponse:
78 properties:
79 token:
80 type: string
81 type: object
82 controllers.MapSummaryResponse:
83 properties:
84 map:
85 $ref: '#/definitions/models.Map'
86 summary:
87 $ref: '#/definitions/models.MapSummary'
88 type: object
89 controllers.ProfileResponse:
90 properties:
91 avatar_link:
92 type: string
93 country_code:
94 type: string
95 profile:
96 type: boolean
97 scores_mp:
98 items:
99 $ref: '#/definitions/controllers.ScoreResponse'
100 type: array
101 scores_sp:
102 items:
103 $ref: '#/definitions/controllers.ScoreResponse'
104 type: array
105 steam_id:
106 type: string
107 user_name:
108 type: string
109 type: object
110 controllers.RankingsResponse:
111 properties:
112 rankings_mp:
113 items:
114 $ref: '#/definitions/models.UserRanking'
115 type: array
116 rankings_sp:
117 items:
118 $ref: '#/definitions/models.UserRanking'
119 type: array
120 type: object
121 controllers.RecordResponse:
122 properties:
123 score_count:
124 type: integer
125 score_time:
126 type: integer
127 type: object
128 controllers.ScoreResponse:
129 properties:
130 map_id:
131 type: integer
132 records: {}
133 type: object
134 controllers.SearchResponse:
135 properties:
136 maps:
137 items:
138 $ref: '#/definitions/models.MapShort'
139 type: array
140 players:
141 items:
142 $ref: '#/definitions/models.UserShort'
143 type: array
144 type: object
145 models.Category:
92 properties: 146 properties:
93 id: 147 id:
94 type: integer 148 type: integer
95 is_coop:
96 type: boolean
97 name: 149 name:
98 type: string 150 type: string
99 type: object 151 type: object
100 models.LoginResponse: 152 models.Chapter:
101 properties: 153 properties:
102 token: 154 id:
155 type: integer
156 name:
157 type: string
158 type: object
159 models.Game:
160 properties:
161 id:
162 type: integer
163 is_coop:
164 type: boolean
165 name:
103 type: string 166 type: string
104 type: object 167 type: object
105 models.Map: 168 models.Map:
@@ -159,52 +222,6 @@ definitions:
159 $ref: '#/definitions/models.MapRoute' 222 $ref: '#/definitions/models.MapRoute'
160 type: array 223 type: array
161 type: object 224 type: object
162 models.MapSummaryResponse:
163 properties:
164 map:
165 $ref: '#/definitions/models.Map'
166 summary:
167 $ref: '#/definitions/models.MapSummary'
168 type: object
169 models.ProfileResponse:
170 properties:
171 avatar_link:
172 type: string
173 country_code:
174 type: string
175 profile:
176 type: boolean
177 scores_mp:
178 items:
179 $ref: '#/definitions/models.ScoreResponse'
180 type: array
181 scores_sp:
182 items:
183 $ref: '#/definitions/models.ScoreResponse'
184 type: array
185 steam_id:
186 type: string
187 user_name:
188 type: string
189 type: object
190 models.RankingsResponse:
191 properties:
192 rankings_mp:
193 items:
194 $ref: '#/definitions/models.UserRanking'
195 type: array
196 rankings_sp:
197 items:
198 $ref: '#/definitions/models.UserRanking'
199 type: array
200 type: object
201 models.RecordResponse:
202 properties:
203 score_count:
204 type: integer
205 score_time:
206 type: integer
207 type: object
208 models.Response: 225 models.Response:
209 properties: 226 properties:
210 data: {} 227 data: {}
@@ -213,23 +230,6 @@ definitions:
213 success: 230 success:
214 type: boolean 231 type: boolean
215 type: object 232 type: object
216 models.ScoreResponse:
217 properties:
218 map_id:
219 type: integer
220 records: {}
221 type: object
222 models.SearchResponse:
223 properties:
224 maps:
225 items:
226 $ref: '#/definitions/models.MapShort'
227 type: array
228 players:
229 items:
230 $ref: '#/definitions/models.UserShort'
231 type: array
232 type: object
233 models.UserRanking: 233 models.UserRanking:
234 properties: 234 properties:
235 total_score: 235 total_score:
@@ -275,7 +275,7 @@ paths:
275 - $ref: '#/definitions/models.Response' 275 - $ref: '#/definitions/models.Response'
276 - properties: 276 - properties:
277 data: 277 data:
278 $ref: '#/definitions/models.ChapterMapsResponse' 278 $ref: '#/definitions/controllers.ChapterMapsResponse'
279 type: object 279 type: object
280 "400": 280 "400":
281 description: Bad Request 281 description: Bad Request
@@ -349,7 +349,7 @@ paths:
349 - $ref: '#/definitions/models.Response' 349 - $ref: '#/definitions/models.Response'
350 - properties: 350 - properties:
351 data: 351 data:
352 $ref: '#/definitions/models.ChaptersResponse' 352 $ref: '#/definitions/controllers.ChaptersResponse'
353 type: object 353 type: object
354 "400": 354 "400":
355 description: Bad Request 355 description: Bad Request
@@ -372,7 +372,7 @@ paths:
372 - $ref: '#/definitions/models.Response' 372 - $ref: '#/definitions/models.Response'
373 - properties: 373 - properties:
374 data: 374 data:
375 $ref: '#/definitions/models.LoginResponse' 375 $ref: '#/definitions/controllers.LoginResponse'
376 type: object 376 type: object
377 "400": 377 "400":
378 description: Bad Request 378 description: Bad Request
@@ -399,7 +399,7 @@ paths:
399 name: request 399 name: request
400 required: true 400 required: true
401 schema: 401 schema:
402 $ref: '#/definitions/models.EditMapImageRequest' 402 $ref: '#/definitions/controllers.EditMapImageRequest'
403 produces: 403 produces:
404 - application/json 404 - application/json
405 responses: 405 responses:
@@ -410,7 +410,7 @@ paths:
410 - $ref: '#/definitions/models.Response' 410 - $ref: '#/definitions/models.Response'
411 - properties: 411 - properties:
412 data: 412 data:
413 $ref: '#/definitions/models.EditMapImageRequest' 413 $ref: '#/definitions/controllers.EditMapImageRequest'
414 type: object 414 type: object
415 "400": 415 "400":
416 description: Bad Request 416 description: Bad Request
@@ -493,7 +493,7 @@ paths:
493 - $ref: '#/definitions/models.Response' 493 - $ref: '#/definitions/models.Response'
494 - properties: 494 - properties:
495 data: 495 data:
496 $ref: '#/definitions/models.RecordResponse' 496 $ref: '#/definitions/controllers.RecordResponse'
497 type: object 497 type: object
498 "400": 498 "400":
499 description: Bad Request 499 description: Bad Request
@@ -524,7 +524,7 @@ paths:
524 name: request 524 name: request
525 required: true 525 required: true
526 schema: 526 schema:
527 $ref: '#/definitions/models.DeleteMapSummaryRequest' 527 $ref: '#/definitions/controllers.DeleteMapSummaryRequest'
528 produces: 528 produces:
529 - application/json 529 - application/json
530 responses: 530 responses:
@@ -535,7 +535,7 @@ paths:
535 - $ref: '#/definitions/models.Response' 535 - $ref: '#/definitions/models.Response'
536 - properties: 536 - properties:
537 data: 537 data:
538 $ref: '#/definitions/models.DeleteMapSummaryRequest' 538 $ref: '#/definitions/controllers.DeleteMapSummaryRequest'
539 type: object 539 type: object
540 "400": 540 "400":
541 description: Bad Request 541 description: Bad Request
@@ -561,7 +561,7 @@ paths:
561 - $ref: '#/definitions/models.Response' 561 - $ref: '#/definitions/models.Response'
562 - properties: 562 - properties:
563 data: 563 data:
564 $ref: '#/definitions/models.MapSummaryResponse' 564 $ref: '#/definitions/controllers.MapSummaryResponse'
565 type: object 565 type: object
566 "400": 566 "400":
567 description: Bad Request 567 description: Bad Request
@@ -587,7 +587,7 @@ paths:
587 name: request 587 name: request
588 required: true 588 required: true
589 schema: 589 schema:
590 $ref: '#/definitions/models.CreateMapSummaryRequest' 590 $ref: '#/definitions/controllers.CreateMapSummaryRequest'
591 produces: 591 produces:
592 - application/json 592 - application/json
593 responses: 593 responses:
@@ -598,7 +598,7 @@ paths:
598 - $ref: '#/definitions/models.Response' 598 - $ref: '#/definitions/models.Response'
599 - properties: 599 - properties:
600 data: 600 data:
601 $ref: '#/definitions/models.CreateMapSummaryRequest' 601 $ref: '#/definitions/controllers.CreateMapSummaryRequest'
602 type: object 602 type: object
603 "400": 603 "400":
604 description: Bad Request 604 description: Bad Request
@@ -624,7 +624,7 @@ paths:
624 name: request 624 name: request
625 required: true 625 required: true
626 schema: 626 schema:
627 $ref: '#/definitions/models.EditMapSummaryRequest' 627 $ref: '#/definitions/controllers.EditMapSummaryRequest'
628 produces: 628 produces:
629 - application/json 629 - application/json
630 responses: 630 responses:
@@ -635,7 +635,7 @@ paths:
635 - $ref: '#/definitions/models.Response' 635 - $ref: '#/definitions/models.Response'
636 - properties: 636 - properties:
637 data: 637 data:
638 $ref: '#/definitions/models.EditMapSummaryRequest' 638 $ref: '#/definitions/controllers.EditMapSummaryRequest'
639 type: object 639 type: object
640 "400": 640 "400":
641 description: Bad Request 641 description: Bad Request
@@ -664,7 +664,7 @@ paths:
664 - $ref: '#/definitions/models.Response' 664 - $ref: '#/definitions/models.Response'
665 - properties: 665 - properties:
666 data: 666 data:
667 $ref: '#/definitions/models.ProfileResponse' 667 $ref: '#/definitions/controllers.ProfileResponse'
668 type: object 668 type: object
669 "400": 669 "400":
670 description: Bad Request 670 description: Bad Request
@@ -696,7 +696,7 @@ paths:
696 - $ref: '#/definitions/models.Response' 696 - $ref: '#/definitions/models.Response'
697 - properties: 697 - properties:
698 data: 698 data:
699 $ref: '#/definitions/models.ProfileResponse' 699 $ref: '#/definitions/controllers.ProfileResponse'
700 type: object 700 type: object
701 "400": 701 "400":
702 description: Bad Request 702 description: Bad Request
@@ -753,7 +753,7 @@ paths:
753 - $ref: '#/definitions/models.Response' 753 - $ref: '#/definitions/models.Response'
754 - properties: 754 - properties:
755 data: 755 data:
756 $ref: '#/definitions/models.RankingsResponse' 756 $ref: '#/definitions/controllers.RankingsResponse'
757 type: object 757 type: object
758 "400": 758 "400":
759 description: Bad Request 759 description: Bad Request
@@ -779,7 +779,7 @@ paths:
779 - $ref: '#/definitions/models.Response' 779 - $ref: '#/definitions/models.Response'
780 - properties: 780 - properties:
781 data: 781 data:
782 $ref: '#/definitions/models.SearchResponse' 782 $ref: '#/definitions/controllers.SearchResponse'
783 type: object 783 type: object
784 "400": 784 "400":
785 description: Bad Request 785 description: Bad Request
@@ -800,7 +800,7 @@ paths:
800 - $ref: '#/definitions/models.Response' 800 - $ref: '#/definitions/models.Response'
801 - properties: 801 - properties:
802 data: 802 data:
803 $ref: '#/definitions/models.LoginResponse' 803 $ref: '#/definitions/controllers.LoginResponse'
804 type: object 804 type: object
805 "404": 805 "404":
806 description: Not Found 806 description: Not Found
@@ -820,7 +820,7 @@ paths:
820 - $ref: '#/definitions/models.Response' 820 - $ref: '#/definitions/models.Response'
821 - properties: 821 - properties:
822 data: 822 data:
823 $ref: '#/definitions/models.LoginResponse' 823 $ref: '#/definitions/controllers.LoginResponse'
824 type: object 824 type: object
825 "404": 825 "404":
826 description: Not Found 826 description: Not Found
@@ -849,7 +849,7 @@ paths:
849 - $ref: '#/definitions/models.Response' 849 - $ref: '#/definitions/models.Response'
850 - properties: 850 - properties:
851 data: 851 data:
852 $ref: '#/definitions/models.ProfileResponse' 852 $ref: '#/definitions/controllers.ProfileResponse'
853 type: object 853 type: object
854 "400": 854 "400":
855 description: Bad Request 855 description: Bad Request