aboutsummaryrefslogtreecommitdiff
path: root/backend/handlers/mod.go
diff options
context:
space:
mode:
Diffstat (limited to 'backend/handlers/mod.go')
-rw-r--r--backend/handlers/mod.go28
1 files changed, 12 insertions, 16 deletions
diff --git a/backend/handlers/mod.go b/backend/handlers/mod.go
index 1d04a96..3559887 100644
--- a/backend/handlers/mod.go
+++ b/backend/handlers/mod.go
@@ -42,11 +42,10 @@ type EditMapImageRequest struct {
42// @Tags maps 42// @Tags maps
43// @Produce json 43// @Produce json
44// @Param Authorization header string true "JWT Token" 44// @Param Authorization header string true "JWT Token"
45// @Param id path int true "Map ID" 45// @Param mapid path int true "Map ID"
46// @Param request body CreateMapSummaryRequest true "Body" 46// @Param request body CreateMapSummaryRequest true "Body"
47// @Success 200 {object} models.Response{data=CreateMapSummaryRequest} 47// @Success 200 {object} models.Response{data=CreateMapSummaryRequest}
48// @Failure 400 {object} models.Response 48// @Router /maps/{mapid}/summary [post]
49// @Router /maps/{id}/summary [post]
50func CreateMapSummary(c *gin.Context) { 49func CreateMapSummary(c *gin.Context) {
51 // Check if user exists 50 // Check if user exists
52 user, exists := c.Get("user") 51 user, exists := c.Get("user")
@@ -60,7 +59,7 @@ func CreateMapSummary(c *gin.Context) {
60 return 59 return
61 } 60 }
62 // Bind parameter and body 61 // Bind parameter and body
63 id := c.Param("id") 62 id := c.Param("mapid")
64 mapID, err := strconv.Atoi(id) 63 mapID, err := strconv.Atoi(id)
65 if err != nil { 64 if err != nil {
66 c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) 65 c.JSON(http.StatusOK, models.ErrorResponse(err.Error()))
@@ -123,11 +122,10 @@ func CreateMapSummary(c *gin.Context) {
123// @Tags maps 122// @Tags maps
124// @Produce json 123// @Produce json
125// @Param Authorization header string true "JWT Token" 124// @Param Authorization header string true "JWT Token"
126// @Param id path int true "Map ID" 125// @Param mapid path int true "Map ID"
127// @Param request body EditMapSummaryRequest true "Body" 126// @Param request body EditMapSummaryRequest true "Body"
128// @Success 200 {object} models.Response{data=EditMapSummaryRequest} 127// @Success 200 {object} models.Response{data=EditMapSummaryRequest}
129// @Failure 400 {object} models.Response 128// @Router /maps/{mapid}/summary [put]
130// @Router /maps/{id}/summary [put]
131func EditMapSummary(c *gin.Context) { 129func EditMapSummary(c *gin.Context) {
132 // Check if user exists 130 // Check if user exists
133 user, exists := c.Get("user") 131 user, exists := c.Get("user")
@@ -141,7 +139,7 @@ func EditMapSummary(c *gin.Context) {
141 return 139 return
142 } 140 }
143 // Bind parameter and body 141 // Bind parameter and body
144 id := c.Param("id") 142 id := c.Param("mapid")
145 mapID, err := strconv.Atoi(id) 143 mapID, err := strconv.Atoi(id)
146 if err != nil { 144 if err != nil {
147 c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) 145 c.JSON(http.StatusOK, models.ErrorResponse(err.Error()))
@@ -204,11 +202,10 @@ func EditMapSummary(c *gin.Context) {
204// @Tags maps 202// @Tags maps
205// @Produce json 203// @Produce json
206// @Param Authorization header string true "JWT Token" 204// @Param Authorization header string true "JWT Token"
207// @Param id path int true "Map ID" 205// @Param mapid path int true "Map ID"
208// @Param request body DeleteMapSummaryRequest true "Body" 206// @Param request body DeleteMapSummaryRequest true "Body"
209// @Success 200 {object} models.Response{data=DeleteMapSummaryRequest} 207// @Success 200 {object} models.Response{data=DeleteMapSummaryRequest}
210// @Failure 400 {object} models.Response 208// @Router /maps/{mapid}/summary [delete]
211// @Router /maps/{id}/summary [delete]
212func DeleteMapSummary(c *gin.Context) { 209func DeleteMapSummary(c *gin.Context) {
213 // Check if user exists 210 // Check if user exists
214 user, exists := c.Get("user") 211 user, exists := c.Get("user")
@@ -222,7 +219,7 @@ func DeleteMapSummary(c *gin.Context) {
222 return 219 return
223 } 220 }
224 // Bind parameter and body 221 // Bind parameter and body
225 id := c.Param("id") 222 id := c.Param("mapid")
226 mapID, err := strconv.Atoi(id) 223 mapID, err := strconv.Atoi(id)
227 if err != nil { 224 if err != nil {
228 c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) 225 c.JSON(http.StatusOK, models.ErrorResponse(err.Error()))
@@ -289,11 +286,10 @@ func DeleteMapSummary(c *gin.Context) {
289// @Tags maps 286// @Tags maps
290// @Produce json 287// @Produce json
291// @Param Authorization header string true "JWT Token" 288// @Param Authorization header string true "JWT Token"
292// @Param id path int true "Map ID" 289// @Param mapid path int true "Map ID"
293// @Param request body EditMapImageRequest true "Body" 290// @Param request body EditMapImageRequest true "Body"
294// @Success 200 {object} models.Response{data=EditMapImageRequest} 291// @Success 200 {object} models.Response{data=EditMapImageRequest}
295// @Failure 400 {object} models.Response 292// @Router /maps/{mapid}/image [put]
296// @Router /maps/{id}/image [put]
297func EditMapImage(c *gin.Context) { 293func EditMapImage(c *gin.Context) {
298 // Check if user exists 294 // Check if user exists
299 user, exists := c.Get("user") 295 user, exists := c.Get("user")
@@ -307,7 +303,7 @@ func EditMapImage(c *gin.Context) {
307 return 303 return
308 } 304 }
309 // Bind parameter and body 305 // Bind parameter and body
310 id := c.Param("id") 306 id := c.Param("mapid")
311 mapID, err := strconv.Atoi(id) 307 mapID, err := strconv.Atoi(id)
312 if err != nil { 308 if err != nil {
313 c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) 309 c.JSON(http.StatusOK, models.ErrorResponse(err.Error()))