aboutsummaryrefslogtreecommitdiff
path: root/backend/controllers/userController.go
diff options
context:
space:
mode:
authorArda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>2023-07-03 23:16:42 +0300
committerArda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>2023-07-03 23:16:42 +0300
commitc071eeca829a18941fc29f4e4eb8b8f93a65b5c4 (patch)
tree1c68bda13a67ce902e01a89d4b2434e91f457339 /backend/controllers/userController.go
parentfix: save uploaded demos as .dem in order for parser to work (#42) (diff)
downloadlphub-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/userController.go74
1 files changed, 37 insertions, 37 deletions
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]
25func Profile(c *gin.Context) { 25func 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]
112func FetchUser(c *gin.Context) { 112func 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]
214func UpdateUser(c *gin.Context) { 214func 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]
258func UpdateCountryCode(c *gin.Context) { 258func 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")