diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2023-07-03 23:16:42 +0300 |
|---|---|---|
| committer | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2023-07-03 23:16:42 +0300 |
| commit | c071eeca829a18941fc29f4e4eb8b8f93a65b5c4 (patch) | |
| tree | 1c68bda13a67ce902e01a89d4b2434e91f457339 /backend | |
| parent | fix: save uploaded demos as .dem in order for parser to work (#42) (diff) | |
| download | lphub-c071eeca829a18941fc29f4e4eb8b8f93a65b5c4.tar.gz lphub-c071eeca829a18941fc29f4e4eb8b8f93a65b5c4.tar.bz2 lphub-c071eeca829a18941fc29f4e4eb8b8f93a65b5c4.zip | |
docs: refactor docs
Former-commit-id: 3f3833af352d8758ca509a4fe3badedd5250b1ba
Diffstat (limited to '')
| -rw-r--r-- | backend/controllers/homeController.go | 26 | ||||
| -rw-r--r-- | backend/controllers/loginController.go | 38 | ||||
| -rw-r--r-- | backend/controllers/mapController.go | 68 | ||||
| -rw-r--r-- | backend/controllers/modController.go | 54 | ||||
| -rw-r--r-- | backend/controllers/recordController.go | 44 | ||||
| -rw-r--r-- | backend/controllers/userController.go | 74 |
6 files changed, 152 insertions, 152 deletions
diff --git a/backend/controllers/homeController.go b/backend/controllers/homeController.go index b5c6b60..2780e63 100644 --- a/backend/controllers/homeController.go +++ b/backend/controllers/homeController.go | |||
| @@ -23,12 +23,12 @@ func Home(c *gin.Context) { | |||
| 23 | 23 | ||
| 24 | // GET Rankings | 24 | // GET Rankings |
| 25 | // | 25 | // |
| 26 | // @Summary Get rankings of every player. | 26 | // @Description Get rankings of every player. |
| 27 | // @Tags rankings | 27 | // @Tags rankings |
| 28 | // @Produce json | 28 | // @Produce json |
| 29 | // @Success 200 {object} models.Response{data=models.RankingsResponse} | 29 | // @Success 200 {object} models.Response{data=models.RankingsResponse} |
| 30 | // @Failure 400 {object} models.Response | 30 | // @Failure 400 {object} models.Response |
| 31 | // @Router /demo [get] | 31 | // @Router /rankings [get] |
| 32 | func Rankings(c *gin.Context) { | 32 | func Rankings(c *gin.Context) { |
| 33 | rows, err := database.DB.Query(`SELECT steam_id, user_name FROM users`) | 33 | rows, err := database.DB.Query(`SELECT steam_id, user_name FROM users`) |
| 34 | if err != nil { | 34 | if err != nil { |
| @@ -125,13 +125,13 @@ func Rankings(c *gin.Context) { | |||
| 125 | 125 | ||
| 126 | // GET Search With Query | 126 | // GET Search With Query |
| 127 | // | 127 | // |
| 128 | // @Summary Get all user and map data matching to the query. | 128 | // @Description Get all user and map data matching to the query. |
| 129 | // @Tags search | 129 | // @Tags search |
| 130 | // @Produce json | 130 | // @Produce json |
| 131 | // @Param q query string false "Search user or map name." | 131 | // @Param q query string false "Search user or map name." |
| 132 | // @Success 200 {object} models.Response{data=models.SearchResponse} | 132 | // @Success 200 {object} models.Response{data=models.SearchResponse} |
| 133 | // @Failure 400 {object} models.Response | 133 | // @Failure 400 {object} models.Response |
| 134 | // @Router /search [get] | 134 | // @Router /search [get] |
| 135 | func SearchWithQuery(c *gin.Context) { | 135 | func SearchWithQuery(c *gin.Context) { |
| 136 | query := c.Query("q") | 136 | query := c.Query("q") |
| 137 | query = strings.ToLower(query) | 137 | query = strings.ToLower(query) |
diff --git a/backend/controllers/loginController.go b/backend/controllers/loginController.go index b30d26e..ae6e957 100644 --- a/backend/controllers/loginController.go +++ b/backend/controllers/loginController.go | |||
| @@ -17,13 +17,13 @@ import ( | |||
| 17 | 17 | ||
| 18 | // Login | 18 | // Login |
| 19 | // | 19 | // |
| 20 | // @Summary Get (redirect) login page for Steam auth. | 20 | // @Description Get (redirect) login page for Steam auth. |
| 21 | // @Tags login | 21 | // @Tags login |
| 22 | // @Accept json | 22 | // @Accept json |
| 23 | // @Produce json | 23 | // @Produce json |
| 24 | // @Success 200 {object} models.Response{data=models.LoginResponse} | 24 | // @Success 200 {object} models.Response{data=models.LoginResponse} |
| 25 | // @Failure 400 {object} models.Response | 25 | // @Failure 400 {object} models.Response |
| 26 | // @Router /login [get] | 26 | // @Router /login [get] |
| 27 | func Login(c *gin.Context) { | 27 | func Login(c *gin.Context) { |
| 28 | openID := steam_go.NewOpenId(c.Request) | 28 | openID := steam_go.NewOpenId(c.Request) |
| 29 | switch openID.Mode() { | 29 | switch openID.Mode() { |
| @@ -95,13 +95,13 @@ func Login(c *gin.Context) { | |||
| 95 | 95 | ||
| 96 | // GET Token | 96 | // GET Token |
| 97 | // | 97 | // |
| 98 | // @Summary Gets the token cookie value from the user. | 98 | // @Description Gets the token cookie value from the user. |
| 99 | // @Tags auth | 99 | // @Tags auth |
| 100 | // @Produce json | 100 | // @Produce json |
| 101 | // | 101 | // |
| 102 | // @Success 200 {object} models.Response{data=models.LoginResponse} | 102 | // @Success 200 {object} models.Response{data=models.LoginResponse} |
| 103 | // @Failure 404 {object} models.Response | 103 | // @Failure 404 {object} models.Response |
| 104 | // @Router /token [get] | 104 | // @Router /token [get] |
| 105 | func GetCookie(c *gin.Context) { | 105 | func GetCookie(c *gin.Context) { |
| 106 | cookie, err := c.Cookie("token") | 106 | cookie, err := c.Cookie("token") |
| 107 | if err != nil { | 107 | if err != nil { |
| @@ -119,13 +119,13 @@ func GetCookie(c *gin.Context) { | |||
| 119 | 119 | ||
| 120 | // DELETE Token | 120 | // DELETE Token |
| 121 | // | 121 | // |
| 122 | // @Summary Deletes the token cookie from the user. | 122 | // @Description Deletes the token cookie from the user. |
| 123 | // @Tags auth | 123 | // @Tags auth |
| 124 | // @Produce json | 124 | // @Produce json |
| 125 | // | 125 | // |
| 126 | // @Success 200 {object} models.Response{data=models.LoginResponse} | 126 | // @Success 200 {object} models.Response{data=models.LoginResponse} |
| 127 | // @Failure 404 {object} models.Response | 127 | // @Failure 404 {object} models.Response |
| 128 | // @Router /token [delete] | 128 | // @Router /token [delete] |
| 129 | func DeleteCookie(c *gin.Context) { | 129 | func DeleteCookie(c *gin.Context) { |
| 130 | cookie, err := c.Cookie("token") | 130 | cookie, err := c.Cookie("token") |
| 131 | if err != nil { | 131 | if err != nil { |
diff --git a/backend/controllers/mapController.go b/backend/controllers/mapController.go index 7a26554..52b6623 100644 --- a/backend/controllers/mapController.go +++ b/backend/controllers/mapController.go | |||
| @@ -11,13 +11,13 @@ import ( | |||
| 11 | 11 | ||
| 12 | // GET Map Summary | 12 | // GET Map Summary |
| 13 | // | 13 | // |
| 14 | // @Summary Get map summary with specified id. | 14 | // @Description Get map summary with specified id. |
| 15 | // @Tags maps | 15 | // @Tags maps |
| 16 | // @Produce json | 16 | // @Produce json |
| 17 | // @Param id path int true "Map ID" | 17 | // @Param id path int true "Map ID" |
| 18 | // @Success 200 {object} models.Response{data=models.MapSummaryResponse} | 18 | // @Success 200 {object} models.Response{data=models.MapSummaryResponse} |
| 19 | // @Failure 400 {object} models.Response | 19 | // @Failure 400 {object} models.Response |
| 20 | // @Router /maps/{id}/summary [get] | 20 | // @Router /maps/{id}/summary [get] |
| 21 | func FetchMapSummary(c *gin.Context) { | 21 | func FetchMapSummary(c *gin.Context) { |
| 22 | id := c.Param("id") | 22 | id := c.Param("id") |
| 23 | response := models.MapSummaryResponse{Map: models.Map{}, Summary: models.MapSummary{Routes: []models.MapRoute{}}} | 23 | response := models.MapSummaryResponse{Map: models.Map{}, Summary: models.MapSummary{Routes: []models.MapRoute{}}} |
| @@ -69,13 +69,13 @@ func FetchMapSummary(c *gin.Context) { | |||
| 69 | 69 | ||
| 70 | // GET Map Leaderboards | 70 | // GET Map Leaderboards |
| 71 | // | 71 | // |
| 72 | // @Summary Get map leaderboards with specified id. | 72 | // @Description Get map leaderboards with specified id. |
| 73 | // @Tags maps | 73 | // @Tags maps |
| 74 | // @Produce json | 74 | // @Produce json |
| 75 | // @Param id path int true "Map ID" | 75 | // @Param id path int true "Map ID" |
| 76 | // @Success 200 {object} models.Response{data=models.Map{data=models.MapRecords}} | 76 | // @Success 200 {object} models.Response{data=models.Map{data=models.MapRecords}} |
| 77 | // @Failure 400 {object} models.Response | 77 | // @Failure 400 {object} models.Response |
| 78 | // @Router /maps/{id}/leaderboards [get] | 78 | // @Router /maps/{id}/leaderboards [get] |
| 79 | func FetchMapLeaderboards(c *gin.Context) { | 79 | func FetchMapLeaderboards(c *gin.Context) { |
| 80 | // TODO: make new response type | 80 | // TODO: make new response type |
| 81 | id := c.Param("id") | 81 | id := c.Param("id") |
| @@ -186,12 +186,12 @@ func FetchMapLeaderboards(c *gin.Context) { | |||
| 186 | 186 | ||
| 187 | // GET Games | 187 | // GET Games |
| 188 | // | 188 | // |
| 189 | // @Summary Get games from the leaderboards. | 189 | // @Description Get games from the leaderboards. |
| 190 | // @Tags games & chapters | 190 | // @Tags games & chapters |
| 191 | // @Produce json | 191 | // @Produce json |
| 192 | // @Success 200 {object} models.Response{data=[]models.Game} | 192 | // @Success 200 {object} models.Response{data=[]models.Game} |
| 193 | // @Failure 400 {object} models.Response | 193 | // @Failure 400 {object} models.Response |
| 194 | // @Router /games [get] | 194 | // @Router /games [get] |
| 195 | func FetchGames(c *gin.Context) { | 195 | func FetchGames(c *gin.Context) { |
| 196 | rows, err := database.DB.Query(`SELECT id, name FROM games`) | 196 | rows, err := database.DB.Query(`SELECT id, name FROM games`) |
| 197 | if err != nil { | 197 | if err != nil { |
| @@ -216,13 +216,13 @@ func FetchGames(c *gin.Context) { | |||
| 216 | 216 | ||
| 217 | // GET Chapters of a Game | 217 | // GET Chapters of a Game |
| 218 | // | 218 | // |
| 219 | // @Summary Get chapters from the specified game id. | 219 | // @Description Get chapters from the specified game id. |
| 220 | // @Tags games & chapters | 220 | // @Tags games & chapters |
| 221 | // @Produce json | 221 | // @Produce json |
| 222 | // @Param id path int true "Game ID" | 222 | // @Param id path int true "Game ID" |
| 223 | // @Success 200 {object} models.Response{data=models.ChaptersResponse} | 223 | // @Success 200 {object} models.Response{data=models.ChaptersResponse} |
| 224 | // @Failure 400 {object} models.Response | 224 | // @Failure 400 {object} models.Response |
| 225 | // @Router /games/{id} [get] | 225 | // @Router /games/{id} [get] |
| 226 | func FetchChapters(c *gin.Context) { | 226 | func FetchChapters(c *gin.Context) { |
| 227 | gameID := c.Param("id") | 227 | gameID := c.Param("id") |
| 228 | intID, err := strconv.Atoi(gameID) | 228 | intID, err := strconv.Atoi(gameID) |
| @@ -258,13 +258,13 @@ func FetchChapters(c *gin.Context) { | |||
| 258 | 258 | ||
| 259 | // GET Maps of a Chapter | 259 | // GET Maps of a Chapter |
| 260 | // | 260 | // |
| 261 | // @Summary Get maps from the specified chapter id. | 261 | // @Description Get maps from the specified chapter id. |
| 262 | // @Tags games & chapters | 262 | // @Tags games & chapters |
| 263 | // @Produce json | 263 | // @Produce json |
| 264 | // @Param id path int true "Chapter ID" | 264 | // @Param id path int true "Chapter ID" |
| 265 | // @Success 200 {object} models.Response{data=models.ChapterMapsResponse} | 265 | // @Success 200 {object} models.Response{data=models.ChapterMapsResponse} |
| 266 | // @Failure 400 {object} models.Response | 266 | // @Failure 400 {object} models.Response |
| 267 | // @Router /chapters/{id} [get] | 267 | // @Router /chapters/{id} [get] |
| 268 | func FetchChapterMaps(c *gin.Context) { | 268 | func FetchChapterMaps(c *gin.Context) { |
| 269 | chapterID := c.Param("id") | 269 | chapterID := c.Param("id") |
| 270 | intID, err := strconv.Atoi(chapterID) | 270 | intID, err := strconv.Atoi(chapterID) |
diff --git a/backend/controllers/modController.go b/backend/controllers/modController.go index f1874f7..d6dc4d4 100644 --- a/backend/controllers/modController.go +++ b/backend/controllers/modController.go | |||
| @@ -11,15 +11,15 @@ import ( | |||
| 11 | 11 | ||
| 12 | // POST Map Summary | 12 | // POST Map Summary |
| 13 | // | 13 | // |
| 14 | // @Summary Create map summary with specified map id. | 14 | // @Description Create map summary with specified map id. |
| 15 | // @Tags maps | 15 | // @Tags maps |
| 16 | // @Produce json | 16 | // @Produce json |
| 17 | // @Param Authorization header string true "JWT Token" | 17 | // @Param Authorization header string true "JWT Token" |
| 18 | // @Param id path int true "Map ID" | 18 | // @Param id path int true "Map ID" |
| 19 | // @Param request body models.CreateMapSummaryRequest true "Body" | 19 | // @Param request body models.CreateMapSummaryRequest true "Body" |
| 20 | // @Success 200 {object} models.Response{data=models.CreateMapSummaryRequest} | 20 | // @Success 200 {object} models.Response{data=models.CreateMapSummaryRequest} |
| 21 | // @Failure 400 {object} models.Response | 21 | // @Failure 400 {object} models.Response |
| 22 | // @Router /maps/{id}/summary [post] | 22 | // @Router /maps/{id}/summary [post] |
| 23 | func CreateMapSummary(c *gin.Context) { | 23 | func CreateMapSummary(c *gin.Context) { |
| 24 | // Check if user exists | 24 | // Check if user exists |
| 25 | user, exists := c.Get("user") | 25 | user, exists := c.Get("user") |
| @@ -97,15 +97,15 @@ func CreateMapSummary(c *gin.Context) { | |||
| 97 | 97 | ||
| 98 | // PUT Map Summary | 98 | // PUT Map Summary |
| 99 | // | 99 | // |
| 100 | // @Summary Edit map summary with specified map id. | 100 | // @Description Edit map summary with specified map id. |
| 101 | // @Tags maps | 101 | // @Tags maps |
| 102 | // @Produce json | 102 | // @Produce json |
| 103 | // @Param Authorization header string true "JWT Token" | 103 | // @Param Authorization header string true "JWT Token" |
| 104 | // @Param id path int true "Map ID" | 104 | // @Param id path int true "Map ID" |
| 105 | // @Param request body models.EditMapSummaryRequest true "Body" | 105 | // @Param request body models.EditMapSummaryRequest true "Body" |
| 106 | // @Success 200 {object} models.Response{data=models.EditMapSummaryRequest} | 106 | // @Success 200 {object} models.Response{data=models.EditMapSummaryRequest} |
| 107 | // @Failure 400 {object} models.Response | 107 | // @Failure 400 {object} models.Response |
| 108 | // @Router /maps/{id}/summary [put] | 108 | // @Router /maps/{id}/summary [put] |
| 109 | func EditMapSummary(c *gin.Context) { | 109 | func EditMapSummary(c *gin.Context) { |
| 110 | // Check if user exists | 110 | // Check if user exists |
| 111 | user, exists := c.Get("user") | 111 | user, exists := c.Get("user") |
| @@ -180,15 +180,15 @@ func EditMapSummary(c *gin.Context) { | |||
| 180 | 180 | ||
| 181 | // DELETE Map Summary | 181 | // DELETE Map Summary |
| 182 | // | 182 | // |
| 183 | // @Summary Delete map summary with specified map id. | 183 | // @Description Delete map summary with specified map id. |
| 184 | // @Tags maps | 184 | // @Tags maps |
| 185 | // @Produce json | 185 | // @Produce json |
| 186 | // @Param Authorization header string true "JWT Token" | 186 | // @Param Authorization header string true "JWT Token" |
| 187 | // @Param id path int true "Map ID" | 187 | // @Param id path int true "Map ID" |
| 188 | // @Param request body models.DeleteMapSummaryRequest true "Body" | 188 | // @Param request body models.DeleteMapSummaryRequest true "Body" |
| 189 | // @Success 200 {object} models.Response{data=models.DeleteMapSummaryRequest} | 189 | // @Success 200 {object} models.Response{data=models.DeleteMapSummaryRequest} |
| 190 | // @Failure 400 {object} models.Response | 190 | // @Failure 400 {object} models.Response |
| 191 | // @Router /maps/{id}/summary [delete] | 191 | // @Router /maps/{id}/summary [delete] |
| 192 | func DeleteMapSummary(c *gin.Context) { | 192 | func DeleteMapSummary(c *gin.Context) { |
| 193 | // Check if user exists | 193 | // Check if user exists |
| 194 | user, exists := c.Get("user") | 194 | user, exists := c.Get("user") |
diff --git a/backend/controllers/recordController.go b/backend/controllers/recordController.go index 409a2e7..af8eb63 100644 --- a/backend/controllers/recordController.go +++ b/backend/controllers/recordController.go | |||
| @@ -21,20 +21,20 @@ import ( | |||
| 21 | 21 | ||
| 22 | // POST Record | 22 | // POST Record |
| 23 | // | 23 | // |
| 24 | // @Summary Post record with demo of a specific map. | 24 | // @Description Post record with demo of a specific map. |
| 25 | // @Tags maps | 25 | // @Tags maps |
| 26 | // @Accept mpfd | 26 | // @Accept mpfd |
| 27 | // @Produce json | 27 | // @Produce json |
| 28 | // @Param id path int true "Map ID" | 28 | // @Param id path int true "Map ID" |
| 29 | // @Param Authorization header string true "JWT Token" | 29 | // @Param Authorization header string true "JWT Token" |
| 30 | // @Param host_demo formData file true "Host Demo" | 30 | // @Param host_demo formData file true "Host Demo" |
| 31 | // @Param partner_demo formData file false "Partner Demo" | 31 | // @Param partner_demo formData file false "Partner Demo" |
| 32 | // @Param is_partner_orange formData boolean false "Is Partner Orange" | 32 | // @Param is_partner_orange formData boolean false "Is Partner Orange" |
| 33 | // @Param partner_id formData string false "Partner ID" | 33 | // @Param partner_id formData string false "Partner ID" |
| 34 | // @Success 200 {object} models.Response | 34 | // @Success 200 {object} models.Response |
| 35 | // @Failure 400 {object} models.Response | 35 | // @Failure 400 {object} models.Response |
| 36 | // @Failure 401 {object} models.Response | 36 | // @Failure 401 {object} models.Response |
| 37 | // @Router /maps/{id}/record [post] | 37 | // @Router /maps/{id}/record [post] |
| 38 | func CreateRecordWithDemo(c *gin.Context) { | 38 | func CreateRecordWithDemo(c *gin.Context) { |
| 39 | mapId := c.Param("id") | 39 | mapId := c.Param("id") |
| 40 | // Check if user exists | 40 | // Check if user exists |
| @@ -189,14 +189,14 @@ func CreateRecordWithDemo(c *gin.Context) { | |||
| 189 | 189 | ||
| 190 | // GET Demo | 190 | // GET Demo |
| 191 | // | 191 | // |
| 192 | // @Summary Get demo with specified demo uuid. | 192 | // @Description Get demo with specified demo uuid. |
| 193 | // @Tags demo | 193 | // @Tags demo |
| 194 | // @Accept json | 194 | // @Accept json |
| 195 | // @Produce octet-stream | 195 | // @Produce octet-stream |
| 196 | // @Param uuid query int true "Demo UUID" | 196 | // @Param uuid query string true "Demo UUID" |
| 197 | // @Success 200 {file} binary "Demo File" | 197 | // @Success 200 {file} binary "Demo File" |
| 198 | // @Failure 400 {object} models.Response | 198 | // @Failure 400 {object} models.Response |
| 199 | // @Router /demos [get] | 199 | // @Router /demos [get] |
| 200 | func DownloadDemoWithID(c *gin.Context) { | 200 | func DownloadDemoWithID(c *gin.Context) { |
| 201 | uuid := c.Query("uuid") | 201 | uuid := c.Query("uuid") |
| 202 | var locationID string | 202 | var locationID string |
diff --git a/backend/controllers/userController.go b/backend/controllers/userController.go index cbce0fe..e73b1fe 100644 --- a/backend/controllers/userController.go +++ b/backend/controllers/userController.go | |||
| @@ -13,15 +13,15 @@ import ( | |||
| 13 | 13 | ||
| 14 | // GET Profile | 14 | // GET Profile |
| 15 | // | 15 | // |
| 16 | // @Summary Get profile page of session user. | 16 | // @Description Get profile page of session user. |
| 17 | // @Tags users | 17 | // @Tags users |
| 18 | // @Accept json | 18 | // @Accept json |
| 19 | // @Produce json | 19 | // @Produce json |
| 20 | // @Param Authorization header string true "JWT Token" | 20 | // @Param Authorization header string true "JWT Token" |
| 21 | // @Success 200 {object} models.Response{data=models.ProfileResponse} | 21 | // @Success 200 {object} models.Response{data=models.ProfileResponse} |
| 22 | // @Failure 400 {object} models.Response | 22 | // @Failure 400 {object} models.Response |
| 23 | // @Failure 401 {object} models.Response | 23 | // @Failure 401 {object} models.Response |
| 24 | // @Router /profile [get] | 24 | // @Router /profile [get] |
| 25 | func Profile(c *gin.Context) { | 25 | func Profile(c *gin.Context) { |
| 26 | // Check if user exists | 26 | // Check if user exists |
| 27 | user, exists := c.Get("user") | 27 | user, exists := c.Get("user") |
| @@ -100,15 +100,15 @@ func Profile(c *gin.Context) { | |||
| 100 | 100 | ||
| 101 | // GET User | 101 | // GET User |
| 102 | // | 102 | // |
| 103 | // @Summary Get profile page of another user. | 103 | // @Description Get profile page of another user. |
| 104 | // @Tags users | 104 | // @Tags users |
| 105 | // @Accept json | 105 | // @Accept json |
| 106 | // @Produce json | 106 | // @Produce json |
| 107 | // @Param id path int true "User ID" | 107 | // @Param id path int true "User ID" |
| 108 | // @Success 200 {object} models.Response{data=models.ProfileResponse} | 108 | // @Success 200 {object} models.Response{data=models.ProfileResponse} |
| 109 | // @Failure 400 {object} models.Response | 109 | // @Failure 400 {object} models.Response |
| 110 | // @Failure 404 {object} models.Response | 110 | // @Failure 404 {object} models.Response |
| 111 | // @Router /users/{id} [get] | 111 | // @Router /users/{id} [get] |
| 112 | func FetchUser(c *gin.Context) { | 112 | func FetchUser(c *gin.Context) { |
| 113 | id := c.Param("id") | 113 | id := c.Param("id") |
| 114 | // Check if id is all numbers and 17 length | 114 | // Check if id is all numbers and 17 length |
| @@ -202,15 +202,15 @@ func FetchUser(c *gin.Context) { | |||
| 202 | 202 | ||
| 203 | // PUT Profile | 203 | // PUT Profile |
| 204 | // | 204 | // |
| 205 | // @Summary Update profile page of session user. | 205 | // @Description Update profile page of session user. |
| 206 | // @Tags users | 206 | // @Tags users |
| 207 | // @Accept json | 207 | // @Accept json |
| 208 | // @Produce json | 208 | // @Produce json |
| 209 | // @Param Authorization header string true "JWT Token" | 209 | // @Param Authorization header string true "JWT Token" |
| 210 | // @Success 200 {object} models.Response{data=models.ProfileResponse} | 210 | // @Success 200 {object} models.Response{data=models.ProfileResponse} |
| 211 | // @Failure 400 {object} models.Response | 211 | // @Failure 400 {object} models.Response |
| 212 | // @Failure 401 {object} models.Response | 212 | // @Failure 401 {object} models.Response |
| 213 | // @Router /profile [post] | 213 | // @Router /profile [post] |
| 214 | func UpdateUser(c *gin.Context) { | 214 | func UpdateUser(c *gin.Context) { |
| 215 | // Check if user exists | 215 | // Check if user exists |
| 216 | user, exists := c.Get("user") | 216 | user, exists := c.Get("user") |
| @@ -245,16 +245,16 @@ func UpdateUser(c *gin.Context) { | |||
| 245 | 245 | ||
| 246 | // PUT Profile/CountryCode | 246 | // PUT Profile/CountryCode |
| 247 | // | 247 | // |
| 248 | // @Summary Update country code of session user. | 248 | // @Description Update country code of session user. |
| 249 | // @Tags users | 249 | // @Tags users |
| 250 | // @Accept json | 250 | // @Accept json |
| 251 | // @Produce json | 251 | // @Produce json |
| 252 | // @Param Authorization header string true "JWT Token" | 252 | // @Param Authorization header string true "JWT Token" |
| 253 | // @Param country_code query string true "Country Code [XX]" | 253 | // @Param country_code query string true "Country Code [XX]" |
| 254 | // @Success 200 {object} models.Response | 254 | // @Success 200 {object} models.Response |
| 255 | // @Failure 400 {object} models.Response | 255 | // @Failure 400 {object} models.Response |
| 256 | // @Failure 401 {object} models.Response | 256 | // @Failure 401 {object} models.Response |
| 257 | // @Router /profile [put] | 257 | // @Router /profile [put] |
| 258 | func UpdateCountryCode(c *gin.Context) { | 258 | func UpdateCountryCode(c *gin.Context) { |
| 259 | // Check if user exists | 259 | // Check if user exists |
| 260 | user, exists := c.Get("user") | 260 | user, exists := c.Get("user") |