aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/database/init.sql1
-rw-r--r--backend/handlers/discussions.go35
-rw-r--r--backend/handlers/map.go4
-rw-r--r--backend/handlers/mod.go8
-rw-r--r--backend/handlers/record.go4
-rw-r--r--docs/docs.go35
-rw-r--r--docs/swagger.json35
-rw-r--r--docs/swagger.yaml34
8 files changed, 83 insertions, 73 deletions
diff --git a/backend/database/init.sql b/backend/database/init.sql
index 9851ad7..54867ca 100644
--- a/backend/database/init.sql
+++ b/backend/database/init.sql
@@ -91,6 +91,7 @@ CREATE TABLE map_discussions (
91 content TEXT NOT NULL, 91 content TEXT NOT NULL,
92 created_at TIMESTAMP NOT NULL DEFAULT now(), 92 created_at TIMESTAMP NOT NULL DEFAULT now(),
93 updated_at TIMESTAMP NOT NULL DEFAULT now(), 93 updated_at TIMESTAMP NOT NULL DEFAULT now(),
94 is_deleted BOOLEAN NOT NULL DEFAULT false,
94 PRIMARY KEY (id), 95 PRIMARY KEY (id),
95 FOREIGN KEY (map_id) REFERENCES maps(id), 96 FOREIGN KEY (map_id) REFERENCES maps(id),
96 FOREIGN KEY (user_id) REFERENCES users(steam_id) 97 FOREIGN KEY (user_id) REFERENCES users(steam_id)
diff --git a/backend/handlers/discussions.go b/backend/handlers/discussions.go
index 04c91d0..89297f2 100644
--- a/backend/handlers/discussions.go
+++ b/backend/handlers/discussions.go
@@ -24,6 +24,7 @@ type MapDiscussion struct {
24 Title string `json:"title"` 24 Title string `json:"title"`
25 Content string `json:"content"` 25 Content string `json:"content"`
26 // Upvotes int `json:"upvotes"` 26 // Upvotes int `json:"upvotes"`
27 CreatedAt time.Time `json:"created_at"`
27 UpdatedAt time.Time `json:"updated_at"` 28 UpdatedAt time.Time `json:"updated_at"`
28 Comments []MapDiscussionComment `json:"comments"` 29 Comments []MapDiscussionComment `json:"comments"`
29} 30}
@@ -51,7 +52,7 @@ type EditMapDiscussionRequest struct {
51// GET Map Discussions 52// GET Map Discussions
52// 53//
53// @Description Get map discussions with specified map id. 54// @Description Get map discussions with specified map id.
54// @Tags maps 55// @Tags maps / discussions
55// @Produce json 56// @Produce json
56// @Param mapid path int true "Map ID" 57// @Param mapid path int true "Map ID"
57// @Success 200 {object} models.Response{data=MapDiscussionsResponse} 58// @Success 200 {object} models.Response{data=MapDiscussionsResponse}
@@ -64,8 +65,8 @@ func FetchMapDiscussions(c *gin.Context) {
64 c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) 65 c.JSON(http.StatusOK, models.ErrorResponse(err.Error()))
65 return 66 return
66 } 67 }
67 sql := `SELECT md.id, u.steam_id, u.user_name, u.avatar_link, md.title, md.content, md.updated_at FROM map_discussions md 68 sql := `SELECT md.id, u.steam_id, u.user_name, u.avatar_link, md.title, md.content, md.created_at, md.updated_at FROM map_discussions md
68 INNER JOIN users u ON md.user_id = u.steam_id WHERE md.map_id = $1 69 INNER JOIN users u ON md.user_id = u.steam_id WHERE md.map_id = $1 AND is_deleted = false
69 ORDER BY md.updated_at DESC` 70 ORDER BY md.updated_at DESC`
70 rows, err := database.DB.Query(sql, mapID) 71 rows, err := database.DB.Query(sql, mapID)
71 if err != nil { 72 if err != nil {
@@ -75,7 +76,7 @@ func FetchMapDiscussions(c *gin.Context) {
75 // Get discussion data 76 // Get discussion data
76 for rows.Next() { 77 for rows.Next() {
77 discussion := MapDiscussion{} 78 discussion := MapDiscussion{}
78 err := rows.Scan(&discussion.ID, &discussion.Creator.SteamID, &discussion.Creator.UserName, &discussion.Creator.AvatarLink, &discussion.Title, &discussion.Content, &discussion.UpdatedAt) 79 err := rows.Scan(&discussion.ID, &discussion.Creator.SteamID, &discussion.Creator.UserName, &discussion.Creator.AvatarLink, &discussion.Title, &discussion.Content, &discussion.CreatedAt, &discussion.UpdatedAt)
79 if err != nil { 80 if err != nil {
80 c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) 81 c.JSON(http.StatusOK, models.ErrorResponse(err.Error()))
81 return 82 return
@@ -92,7 +93,7 @@ func FetchMapDiscussions(c *gin.Context) {
92// GET Map Discussion 93// GET Map Discussion
93// 94//
94// @Description Get map discussion with specified map and discussion id. 95// @Description Get map discussion with specified map and discussion id.
95// @Tags maps 96// @Tags maps / discussions
96// @Produce json 97// @Produce json
97// @Param mapid path int true "Map ID" 98// @Param mapid path int true "Map ID"
98// @Param discussionid path int true "Discussion ID" 99// @Param discussionid path int true "Discussion ID"
@@ -111,9 +112,9 @@ func FetchMapDiscussion(c *gin.Context) {
111 c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) 112 c.JSON(http.StatusOK, models.ErrorResponse(err.Error()))
112 return 113 return
113 } 114 }
114 sql := `SELECT md.id, u.steam_id, u.user_name, u.avatar_link, md.title, md.content, md.updated_at FROM map_discussions md 115 sql := `SELECT md.id, u.steam_id, u.user_name, u.avatar_link, md.title, md.content, md.created_at, md.updated_at FROM map_discussions md
115 INNER JOIN users u ON md.user_id = u.steam_id WHERE md.map_id = $1 AND md.id = $2` 116 INNER JOIN users u ON md.user_id = u.steam_id WHERE md.map_id = $1 AND md.id = $2 AND is_deleted = false`
116 err = database.DB.QueryRow(sql, mapID, discussionID).Scan(&response.Discussion.ID, &response.Discussion.Creator.SteamID, &response.Discussion.Creator.UserName, &response.Discussion.Creator.AvatarLink, &response.Discussion.Title, &response.Discussion.Content, &response.Discussion.UpdatedAt) 117 err = database.DB.QueryRow(sql, mapID, discussionID).Scan(&response.Discussion.ID, &response.Discussion.Creator.SteamID, &response.Discussion.Creator.UserName, &response.Discussion.Creator.AvatarLink, &response.Discussion.Title, &response.Discussion.Content, &response.Discussion.CreatedAt, &response.Discussion.UpdatedAt)
117 if err != nil { 118 if err != nil {
118 c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) 119 c.JSON(http.StatusOK, models.ErrorResponse(err.Error()))
119 return 120 return
@@ -145,7 +146,7 @@ func FetchMapDiscussion(c *gin.Context) {
145// POST Map Discussion 146// POST Map Discussion
146// 147//
147// @Description Create map discussion with specified map id. 148// @Description Create map discussion with specified map id.
148// @Tags maps 149// @Tags maps / discussions
149// @Produce json 150// @Produce json
150// @Param Authorization header string true "JWT Token" 151// @Param Authorization header string true "JWT Token"
151// @Param mapid path int true "Map ID" 152// @Param mapid path int true "Map ID"
@@ -185,11 +186,11 @@ func CreateMapDiscussion(c *gin.Context) {
185// POST Map Discussion Comment 186// POST Map Discussion Comment
186// 187//
187// @Description Create map discussion comment with specified map id. 188// @Description Create map discussion comment with specified map id.
188// @Tags maps 189// @Tags maps / discussions
189// @Produce json 190// @Produce json
190// @Param Authorization header string true "JWT Token" 191// @Param Authorization header string true "JWT Token"
191// @Param mapid path int true "Map ID" 192// @Param mapid path int true "Map ID"
192// @Param discussionid path int true "Discussion ID" 193// @Param discussionid path int true "Discussion ID"
193// @Param request body CreateMapDiscussionCommentRequest true "Body" 194// @Param request body CreateMapDiscussionCommentRequest true "Body"
194// @Success 200 {object} models.Response{data=CreateMapDiscussionCommentRequest} 195// @Success 200 {object} models.Response{data=CreateMapDiscussionCommentRequest}
195// @Router /maps/{mapid}/discussions/{discussionid} [post] 196// @Router /maps/{mapid}/discussions/{discussionid} [post]
@@ -231,7 +232,7 @@ func CreateMapDiscussionComment(c *gin.Context) {
231// PUT Map Discussion 232// PUT Map Discussion
232// 233//
233// @Description Edit map discussion with specified map id. 234// @Description Edit map discussion with specified map id.
234// @Tags maps 235// @Tags maps / discussions
235// @Produce json 236// @Produce json
236// @Param Authorization header string true "JWT Token" 237// @Param Authorization header string true "JWT Token"
237// @Param mapid path int true "Map ID" 238// @Param mapid path int true "Map ID"
@@ -260,7 +261,7 @@ func EditMapDiscussion(c *gin.Context) {
260 c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) 261 c.JSON(http.StatusOK, models.ErrorResponse(err.Error()))
261 return 262 return
262 } 263 }
263 sql := `UPDATE map_discussions SET title = $4, content = $5, updated_at = $6 WHERE id = $1 AND map_id = $2 AND user_id = $3` 264 sql := `UPDATE map_discussions SET title = $4, content = $5, updated_at = $6 WHERE id = $1 AND map_id = $2 AND user_id = $3 AND is_deleted = false`
264 result, err := database.DB.Exec(sql, discussionID, mapID, user.(models.User).SteamID, request.Title, request.Content, time.Now().UTC()) 265 result, err := database.DB.Exec(sql, discussionID, mapID, user.(models.User).SteamID, request.Title, request.Content, time.Now().UTC())
265 if err != nil { 266 if err != nil {
266 c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) 267 c.JSON(http.StatusOK, models.ErrorResponse(err.Error()))
@@ -282,10 +283,10 @@ func EditMapDiscussion(c *gin.Context) {
282 }) 283 })
283} 284}
284 285
285// DELETE Map Summary 286// DELETE Map Discussion
286// 287//
287// @Description Delete map summary with specified map id. 288// @Description Delete map discussion with specified map id.
288// @Tags maps 289// @Tags maps / discussions
289// @Produce json 290// @Produce json
290// @Param Authorization header string true "JWT Token" 291// @Param Authorization header string true "JWT Token"
291// @Param mapid path int true "Map ID" 292// @Param mapid path int true "Map ID"
@@ -308,7 +309,7 @@ func DeleteMapDiscussion(c *gin.Context) {
308 c.JSON(http.StatusOK, models.ErrorResponse("User not logged in.")) 309 c.JSON(http.StatusOK, models.ErrorResponse("User not logged in."))
309 return 310 return
310 } 311 }
311 sql := `DELETE FROM map_discussions WHERE id = $1 AND map_id = $2 AND user_id = $3` 312 sql := `UPDATE map_discussions SET is_disabled = true WHERE id = $1 AND map_id = $2 AND user_id = $3`
312 result, err := database.DB.Exec(sql, discussionID, mapID, user.(models.User).SteamID) 313 result, err := database.DB.Exec(sql, discussionID, mapID, user.(models.User).SteamID)
313 if err != nil { 314 if err != nil {
314 c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) 315 c.JSON(http.StatusOK, models.ErrorResponse(err.Error()))
diff --git a/backend/handlers/map.go b/backend/handlers/map.go
index f985a23..dfadade 100644
--- a/backend/handlers/map.go
+++ b/backend/handlers/map.go
@@ -61,7 +61,7 @@ type RecordMultiplayer struct {
61// GET Map Summary 61// GET Map Summary
62// 62//
63// @Description Get map summary with specified id. 63// @Description Get map summary with specified id.
64// @Tags maps 64// @Tags maps / summary
65// @Produce json 65// @Produce json
66// @Param mapid path int true "Map ID" 66// @Param mapid path int true "Map ID"
67// @Success 200 {object} models.Response{data=MapSummaryResponse} 67// @Success 200 {object} models.Response{data=MapSummaryResponse}
@@ -140,7 +140,7 @@ func FetchMapSummary(c *gin.Context) {
140// GET Map Leaderboards 140// GET Map Leaderboards
141// 141//
142// @Description Get map leaderboards with specified id. 142// @Description Get map leaderboards with specified id.
143// @Tags maps 143// @Tags maps / leaderboards
144// @Produce json 144// @Produce json
145// @Param mapid path int true "Map ID" 145// @Param mapid path int true "Map ID"
146// @Param page query int false "Page Number (default: 1)" 146// @Param page query int false "Page Number (default: 1)"
diff --git a/backend/handlers/mod.go b/backend/handlers/mod.go
index 845152f..3709e1d 100644
--- a/backend/handlers/mod.go
+++ b/backend/handlers/mod.go
@@ -40,7 +40,7 @@ type EditMapImageRequest struct {
40// POST Map Summary 40// POST Map Summary
41// 41//
42// @Description Create map summary with specified map id. 42// @Description Create map summary with specified map id.
43// @Tags maps 43// @Tags maps / summary
44// @Produce json 44// @Produce json
45// @Param Authorization header string true "JWT Token" 45// @Param Authorization header string true "JWT Token"
46// @Param mapid path int true "Map ID" 46// @Param mapid path int true "Map ID"
@@ -124,7 +124,7 @@ func CreateMapSummary(c *gin.Context) {
124// PUT Map Summary 124// PUT Map Summary
125// 125//
126// @Description Edit map summary with specified map id. 126// @Description Edit map summary with specified map id.
127// @Tags maps 127// @Tags maps / summary
128// @Produce json 128// @Produce json
129// @Param Authorization header string true "JWT Token" 129// @Param Authorization header string true "JWT Token"
130// @Param mapid path int true "Map ID" 130// @Param mapid path int true "Map ID"
@@ -209,7 +209,7 @@ func EditMapSummary(c *gin.Context) {
209// DELETE Map Summary 209// DELETE Map Summary
210// 210//
211// @Description Delete map summary with specified map id. 211// @Description Delete map summary with specified map id.
212// @Tags maps 212// @Tags maps / summary
213// @Produce json 213// @Produce json
214// @Param Authorization header string true "JWT Token" 214// @Param Authorization header string true "JWT Token"
215// @Param mapid path int true "Map ID" 215// @Param mapid path int true "Map ID"
@@ -298,7 +298,7 @@ func DeleteMapSummary(c *gin.Context) {
298// PUT Map Image 298// PUT Map Image
299// 299//
300// @Description Edit map image with specified map id. 300// @Description Edit map image with specified map id.
301// @Tags maps 301// @Tags maps / summary
302// @Produce json 302// @Produce json
303// @Param Authorization header string true "JWT Token" 303// @Param Authorization header string true "JWT Token"
304// @Param mapid path int true "Map ID" 304// @Param mapid path int true "Map ID"
diff --git a/backend/handlers/record.go b/backend/handlers/record.go
index 5dff085..79e9d3b 100644
--- a/backend/handlers/record.go
+++ b/backend/handlers/record.go
@@ -35,7 +35,7 @@ type RecordResponse struct {
35// POST Record 35// POST Record
36// 36//
37// @Description Post record with demo of a specific map. 37// @Description Post record with demo of a specific map.
38// @Tags maps 38// @Tags maps / leaderboards
39// @Accept mpfd 39// @Accept mpfd
40// @Produce json 40// @Produce json
41// @Param mapid path int true "Map ID" 41// @Param mapid path int true "Map ID"
@@ -202,7 +202,7 @@ func CreateRecordWithDemo(c *gin.Context) {
202// DELETE Record 202// DELETE Record
203// 203//
204// @Description Delete record with specified map and record id. 204// @Description Delete record with specified map and record id.
205// @Tags maps 205// @Tags maps / leaderboards
206// @Produce json 206// @Produce json
207// @Param mapid path int true "Map ID" 207// @Param mapid path int true "Map ID"
208// @Param recordid path int true "Record ID" 208// @Param recordid path int true "Record ID"
diff --git a/docs/docs.go b/docs/docs.go
index fc38d35..812bd64 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -328,7 +328,7 @@ const docTemplate = `{
328 "application/json" 328 "application/json"
329 ], 329 ],
330 "tags": [ 330 "tags": [
331 "maps" 331 "maps / discussions"
332 ], 332 ],
333 "parameters": [ 333 "parameters": [
334 { 334 {
@@ -366,7 +366,7 @@ const docTemplate = `{
366 "application/json" 366 "application/json"
367 ], 367 ],
368 "tags": [ 368 "tags": [
369 "maps" 369 "maps / discussions"
370 ], 370 ],
371 "parameters": [ 371 "parameters": [
372 { 372 {
@@ -422,7 +422,7 @@ const docTemplate = `{
422 "application/json" 422 "application/json"
423 ], 423 ],
424 "tags": [ 424 "tags": [
425 "maps" 425 "maps / discussions"
426 ], 426 ],
427 "parameters": [ 427 "parameters": [
428 { 428 {
@@ -467,7 +467,7 @@ const docTemplate = `{
467 "application/json" 467 "application/json"
468 ], 468 ],
469 "tags": [ 469 "tags": [
470 "maps" 470 "maps / discussions"
471 ], 471 ],
472 "parameters": [ 472 "parameters": [
473 { 473 {
@@ -528,7 +528,7 @@ const docTemplate = `{
528 "application/json" 528 "application/json"
529 ], 529 ],
530 "tags": [ 530 "tags": [
531 "maps" 531 "maps / discussions"
532 ], 532 ],
533 "parameters": [ 533 "parameters": [
534 { 534 {
@@ -584,12 +584,12 @@ const docTemplate = `{
584 } 584 }
585 }, 585 },
586 "delete": { 586 "delete": {
587 "description": "Delete map summary with specified map id.", 587 "description": "Delete map discussion with specified map id.",
588 "produces": [ 588 "produces": [
589 "application/json" 589 "application/json"
590 ], 590 ],
591 "tags": [ 591 "tags": [
592 "maps" 592 "maps / discussions"
593 ], 593 ],
594 "parameters": [ 594 "parameters": [
595 { 595 {
@@ -631,7 +631,7 @@ const docTemplate = `{
631 "application/json" 631 "application/json"
632 ], 632 ],
633 "tags": [ 633 "tags": [
634 "maps" 634 "maps / summary"
635 ], 635 ],
636 "parameters": [ 636 "parameters": [
637 { 637 {
@@ -687,7 +687,7 @@ const docTemplate = `{
687 "application/json" 687 "application/json"
688 ], 688 ],
689 "tags": [ 689 "tags": [
690 "maps" 690 "maps / leaderboards"
691 ], 691 ],
692 "parameters": [ 692 "parameters": [
693 { 693 {
@@ -742,7 +742,7 @@ const docTemplate = `{
742 "application/json" 742 "application/json"
743 ], 743 ],
744 "tags": [ 744 "tags": [
745 "maps" 745 "maps / leaderboards"
746 ], 746 ],
747 "parameters": [ 747 "parameters": [
748 { 748 {
@@ -814,7 +814,7 @@ const docTemplate = `{
814 "application/json" 814 "application/json"
815 ], 815 ],
816 "tags": [ 816 "tags": [
817 "maps" 817 "maps / leaderboards"
818 ], 818 ],
819 "parameters": [ 819 "parameters": [
820 { 820 {
@@ -856,7 +856,7 @@ const docTemplate = `{
856 "application/json" 856 "application/json"
857 ], 857 ],
858 "tags": [ 858 "tags": [
859 "maps" 859 "maps / summary"
860 ], 860 ],
861 "parameters": [ 861 "parameters": [
862 { 862 {
@@ -894,7 +894,7 @@ const docTemplate = `{
894 "application/json" 894 "application/json"
895 ], 895 ],
896 "tags": [ 896 "tags": [
897 "maps" 897 "maps / summary"
898 ], 898 ],
899 "parameters": [ 899 "parameters": [
900 { 900 {
@@ -948,7 +948,7 @@ const docTemplate = `{
948 "application/json" 948 "application/json"
949 ], 949 ],
950 "tags": [ 950 "tags": [
951 "maps" 951 "maps / summary"
952 ], 952 ],
953 "parameters": [ 953 "parameters": [
954 { 954 {
@@ -1002,7 +1002,7 @@ const docTemplate = `{
1002 "application/json" 1002 "application/json"
1003 ], 1003 ],
1004 "tags": [ 1004 "tags": [
1005 "maps" 1005 "maps / summary"
1006 ], 1006 ],
1007 "parameters": [ 1007 "parameters": [
1008 { 1008 {
@@ -1555,6 +1555,10 @@ const docTemplate = `{
1555 "content": { 1555 "content": {
1556 "type": "string" 1556 "type": "string"
1557 }, 1557 },
1558 "created_at": {
1559 "description": "Upvotes int ` + "`" + `json:\"upvotes\"` + "`" + `",
1560 "type": "string"
1561 },
1558 "creator": { 1562 "creator": {
1559 "$ref": "#/definitions/models.UserShortWithAvatar" 1563 "$ref": "#/definitions/models.UserShortWithAvatar"
1560 }, 1564 },
@@ -1565,7 +1569,6 @@ const docTemplate = `{
1565 "type": "string" 1569 "type": "string"
1566 }, 1570 },
1567 "updated_at": { 1571 "updated_at": {
1568 "description": "Upvotes int ` + "`" + `json:\"upvotes\"` + "`" + `",
1569 "type": "string" 1572 "type": "string"
1570 } 1573 }
1571 } 1574 }
diff --git a/docs/swagger.json b/docs/swagger.json
index 32efc4b..5e3fcd7 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -322,7 +322,7 @@
322 "application/json" 322 "application/json"
323 ], 323 ],
324 "tags": [ 324 "tags": [
325 "maps" 325 "maps / discussions"
326 ], 326 ],
327 "parameters": [ 327 "parameters": [
328 { 328 {
@@ -360,7 +360,7 @@
360 "application/json" 360 "application/json"
361 ], 361 ],
362 "tags": [ 362 "tags": [
363 "maps" 363 "maps / discussions"
364 ], 364 ],
365 "parameters": [ 365 "parameters": [
366 { 366 {
@@ -416,7 +416,7 @@
416 "application/json" 416 "application/json"
417 ], 417 ],
418 "tags": [ 418 "tags": [
419 "maps" 419 "maps / discussions"
420 ], 420 ],
421 "parameters": [ 421 "parameters": [
422 { 422 {
@@ -461,7 +461,7 @@
461 "application/json" 461 "application/json"
462 ], 462 ],
463 "tags": [ 463 "tags": [
464 "maps" 464 "maps / discussions"
465 ], 465 ],
466 "parameters": [ 466 "parameters": [
467 { 467 {
@@ -522,7 +522,7 @@
522 "application/json" 522 "application/json"
523 ], 523 ],
524 "tags": [ 524 "tags": [
525 "maps" 525 "maps / discussions"
526 ], 526 ],
527 "parameters": [ 527 "parameters": [
528 { 528 {
@@ -578,12 +578,12 @@
578 } 578 }
579 }, 579 },
580 "delete": { 580 "delete": {
581 "description": "Delete map summary with specified map id.", 581 "description": "Delete map discussion with specified map id.",
582 "produces": [ 582 "produces": [
583 "application/json" 583 "application/json"
584 ], 584 ],
585 "tags": [ 585 "tags": [
586 "maps" 586 "maps / discussions"
587 ], 587 ],
588 "parameters": [ 588 "parameters": [
589 { 589 {
@@ -625,7 +625,7 @@
625 "application/json" 625 "application/json"
626 ], 626 ],
627 "tags": [ 627 "tags": [
628 "maps" 628 "maps / summary"
629 ], 629 ],
630 "parameters": [ 630 "parameters": [
631 { 631 {
@@ -681,7 +681,7 @@
681 "application/json" 681 "application/json"
682 ], 682 ],
683 "tags": [ 683 "tags": [
684 "maps" 684 "maps / leaderboards"
685 ], 685 ],
686 "parameters": [ 686 "parameters": [
687 { 687 {
@@ -736,7 +736,7 @@
736 "application/json" 736 "application/json"
737 ], 737 ],
738 "tags": [ 738 "tags": [
739 "maps" 739 "maps / leaderboards"
740 ], 740 ],
741 "parameters": [ 741 "parameters": [
742 { 742 {
@@ -808,7 +808,7 @@
808 "application/json" 808 "application/json"
809 ], 809 ],
810 "tags": [ 810 "tags": [
811 "maps" 811 "maps / leaderboards"
812 ], 812 ],
813 "parameters": [ 813 "parameters": [
814 { 814 {
@@ -850,7 +850,7 @@
850 "application/json" 850 "application/json"
851 ], 851 ],
852 "tags": [ 852 "tags": [
853 "maps" 853 "maps / summary"
854 ], 854 ],
855 "parameters": [ 855 "parameters": [
856 { 856 {
@@ -888,7 +888,7 @@
888 "application/json" 888 "application/json"
889 ], 889 ],
890 "tags": [ 890 "tags": [
891 "maps" 891 "maps / summary"
892 ], 892 ],
893 "parameters": [ 893 "parameters": [
894 { 894 {
@@ -942,7 +942,7 @@
942 "application/json" 942 "application/json"
943 ], 943 ],
944 "tags": [ 944 "tags": [
945 "maps" 945 "maps / summary"
946 ], 946 ],
947 "parameters": [ 947 "parameters": [
948 { 948 {
@@ -996,7 +996,7 @@
996 "application/json" 996 "application/json"
997 ], 997 ],
998 "tags": [ 998 "tags": [
999 "maps" 999 "maps / summary"
1000 ], 1000 ],
1001 "parameters": [ 1001 "parameters": [
1002 { 1002 {
@@ -1549,6 +1549,10 @@
1549 "content": { 1549 "content": {
1550 "type": "string" 1550 "type": "string"
1551 }, 1551 },
1552 "created_at": {
1553 "description": "Upvotes int `json:\"upvotes\"`",
1554 "type": "string"
1555 },
1552 "creator": { 1556 "creator": {
1553 "$ref": "#/definitions/models.UserShortWithAvatar" 1557 "$ref": "#/definitions/models.UserShortWithAvatar"
1554 }, 1558 },
@@ -1559,7 +1563,6 @@
1559 "type": "string" 1563 "type": "string"
1560 }, 1564 },
1561 "updated_at": { 1565 "updated_at": {
1562 "description": "Upvotes int `json:\"upvotes\"`",
1563 "type": "string" 1566 "type": "string"
1564 } 1567 }
1565 } 1568 }
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index f3a848f..ac29f93 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -130,6 +130,9 @@ definitions:
130 type: array 130 type: array
131 content: 131 content:
132 type: string 132 type: string
133 created_at:
134 description: Upvotes int `json:"upvotes"`
135 type: string
133 creator: 136 creator:
134 $ref: '#/definitions/models.UserShortWithAvatar' 137 $ref: '#/definitions/models.UserShortWithAvatar'
135 id: 138 id:
@@ -137,7 +140,6 @@ definitions:
137 title: 140 title:
138 type: string 141 type: string
139 updated_at: 142 updated_at:
140 description: Upvotes int `json:"upvotes"`
141 type: string 143 type: string
142 type: object 144 type: object
143 handlers.MapDiscussionComment: 145 handlers.MapDiscussionComment:
@@ -674,7 +676,7 @@ paths:
674 $ref: '#/definitions/handlers.MapDiscussionsResponse' 676 $ref: '#/definitions/handlers.MapDiscussionsResponse'
675 type: object 677 type: object
676 tags: 678 tags:
677 - maps 679 - maps / discussions
678 post: 680 post:
679 description: Create map discussion with specified map id. 681 description: Create map discussion with specified map id.
680 parameters: 682 parameters:
@@ -707,10 +709,10 @@ paths:
707 $ref: '#/definitions/handlers.CreateMapDiscussionRequest' 709 $ref: '#/definitions/handlers.CreateMapDiscussionRequest'
708 type: object 710 type: object
709 tags: 711 tags:
710 - maps 712 - maps / discussions
711 /maps/{mapid}/discussions/{discussionid}: 713 /maps/{mapid}/discussions/{discussionid}:
712 delete: 714 delete:
713 description: Delete map summary with specified map id. 715 description: Delete map discussion with specified map id.
714 parameters: 716 parameters:
715 - description: JWT Token 717 - description: JWT Token
716 in: header 718 in: header
@@ -735,7 +737,7 @@ paths:
735 schema: 737 schema:
736 $ref: '#/definitions/models.Response' 738 $ref: '#/definitions/models.Response'
737 tags: 739 tags:
738 - maps 740 - maps / discussions
739 get: 741 get:
740 description: Get map discussion with specified map and discussion id. 742 description: Get map discussion with specified map and discussion id.
741 parameters: 743 parameters:
@@ -762,7 +764,7 @@ paths:
762 $ref: '#/definitions/handlers.MapDiscussionResponse' 764 $ref: '#/definitions/handlers.MapDiscussionResponse'
763 type: object 765 type: object
764 tags: 766 tags:
765 - maps 767 - maps / discussions
766 post: 768 post:
767 description: Create map discussion comment with specified map id. 769 description: Create map discussion comment with specified map id.
768 parameters: 770 parameters:
@@ -800,7 +802,7 @@ paths:
800 $ref: '#/definitions/handlers.CreateMapDiscussionCommentRequest' 802 $ref: '#/definitions/handlers.CreateMapDiscussionCommentRequest'
801 type: object 803 type: object
802 tags: 804 tags:
803 - maps 805 - maps / discussions
804 put: 806 put:
805 description: Edit map discussion with specified map id. 807 description: Edit map discussion with specified map id.
806 parameters: 808 parameters:
@@ -838,7 +840,7 @@ paths:
838 $ref: '#/definitions/handlers.EditMapDiscussionRequest' 840 $ref: '#/definitions/handlers.EditMapDiscussionRequest'
839 type: object 841 type: object
840 tags: 842 tags:
841 - maps 843 - maps / discussions
842 /maps/{mapid}/image: 844 /maps/{mapid}/image:
843 put: 845 put:
844 description: Edit map image with specified map id. 846 description: Edit map image with specified map id.
@@ -872,7 +874,7 @@ paths:
872 $ref: '#/definitions/handlers.EditMapImageRequest' 874 $ref: '#/definitions/handlers.EditMapImageRequest'
873 type: object 875 type: object
874 tags: 876 tags:
875 - maps 877 - maps / summary
876 /maps/{mapid}/leaderboards: 878 /maps/{mapid}/leaderboards:
877 get: 879 get:
878 description: Get map leaderboards with specified id. 880 description: Get map leaderboards with specified id.
@@ -903,7 +905,7 @@ paths:
903 $ref: '#/definitions/handlers.MapLeaderboardsResponse' 905 $ref: '#/definitions/handlers.MapLeaderboardsResponse'
904 type: object 906 type: object
905 tags: 907 tags:
906 - maps 908 - maps / leaderboards
907 /maps/{mapid}/record: 909 /maps/{mapid}/record:
908 post: 910 post:
909 consumes: 911 consumes:
@@ -950,7 +952,7 @@ paths:
950 $ref: '#/definitions/handlers.RecordResponse' 952 $ref: '#/definitions/handlers.RecordResponse'
951 type: object 953 type: object
952 tags: 954 tags:
953 - maps 955 - maps / leaderboards
954 /maps/{mapid}/record/{recordid}: 956 /maps/{mapid}/record/{recordid}:
955 delete: 957 delete:
956 description: Delete record with specified map and record id. 958 description: Delete record with specified map and record id.
@@ -978,7 +980,7 @@ paths:
978 schema: 980 schema:
979 $ref: '#/definitions/models.Response' 981 $ref: '#/definitions/models.Response'
980 tags: 982 tags:
981 - maps 983 - maps / leaderboards
982 /maps/{mapid}/summary: 984 /maps/{mapid}/summary:
983 delete: 985 delete:
984 description: Delete map summary with specified map id. 986 description: Delete map summary with specified map id.
@@ -1012,7 +1014,7 @@ paths:
1012 $ref: '#/definitions/handlers.DeleteMapSummaryRequest' 1014 $ref: '#/definitions/handlers.DeleteMapSummaryRequest'
1013 type: object 1015 type: object
1014 tags: 1016 tags:
1015 - maps 1017 - maps / summary
1016 get: 1018 get:
1017 description: Get map summary with specified id. 1019 description: Get map summary with specified id.
1018 parameters: 1020 parameters:
@@ -1034,7 +1036,7 @@ paths:
1034 $ref: '#/definitions/handlers.MapSummaryResponse' 1036 $ref: '#/definitions/handlers.MapSummaryResponse'
1035 type: object 1037 type: object
1036 tags: 1038 tags:
1037 - maps 1039 - maps / summary
1038 post: 1040 post:
1039 description: Create map summary with specified map id. 1041 description: Create map summary with specified map id.
1040 parameters: 1042 parameters:
@@ -1067,7 +1069,7 @@ paths:
1067 $ref: '#/definitions/handlers.CreateMapSummaryRequest' 1069 $ref: '#/definitions/handlers.CreateMapSummaryRequest'
1068 type: object 1070 type: object
1069 tags: 1071 tags:
1070 - maps 1072 - maps / summary
1071 put: 1073 put:
1072 description: Edit map summary with specified map id. 1074 description: Edit map summary with specified map id.
1073 parameters: 1075 parameters:
@@ -1100,7 +1102,7 @@ paths:
1100 $ref: '#/definitions/handlers.EditMapSummaryRequest' 1102 $ref: '#/definitions/handlers.EditMapSummaryRequest'
1101 type: object 1103 type: object
1102 tags: 1104 tags:
1103 - maps 1105 - maps / summary
1104 /profile: 1106 /profile:
1105 get: 1107 get:
1106 consumes: 1108 consumes: