diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2023-08-24 12:32:07 +0300 |
|---|---|---|
| committer | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2023-08-24 12:32:07 +0300 |
| commit | 31e67500ee99629a9a20157d655100e33ec2e91e (patch) | |
| tree | 14bd1fcdc80004e9d8d9a9dbd370623d2439d7a8 | |
| parent | refactor: move structs around for better understanding (diff) | |
| parent | fix: change title handling and login not working (#49) (diff) | |
| download | lphub-31e67500ee99629a9a20157d655100e33ec2e91e.tar.gz lphub-31e67500ee99629a9a20157d655100e33ec2e91e.tar.bz2 lphub-31e67500ee99629a9a20157d655100e33ec2e91e.zip | |
Merge branch 'main' of https://github.com/pektezol/LeastPortalsHub
Former-commit-id: 370185f6542f92a021e51e15955ecda1fa5a674e
| -rw-r--r-- | backend/controllers/loginController.go | 2 | ||||
| -rw-r--r-- | backend/middleware/auth.go | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/backend/controllers/loginController.go b/backend/controllers/loginController.go index 76bf51f..9d772a5 100644 --- a/backend/controllers/loginController.go +++ b/backend/controllers/loginController.go | |||
| @@ -64,7 +64,7 @@ func Login(c *gin.Context) { | |||
| 64 | VALUES ($1, $2, $3, $4)`, steamID, user.PersonaName, user.AvatarFull, user.LocCountryCode) | 64 | VALUES ($1, $2, $3, $4)`, steamID, user.PersonaName, user.AvatarFull, user.LocCountryCode) |
| 65 | } | 65 | } |
| 66 | moderator := false | 66 | moderator := false |
| 67 | rows, _ := database.DB.Query("SELECT title_name FROM titles WHERE user_id = $1", steamID) | 67 | rows, _ := database.DB.Query("SELECT title_name FROM titles t INNER JOIN user_titles ut ON t.id=ut.title_id WHERE ut.user_id = $1", steamID) |
| 68 | for rows.Next() { | 68 | for rows.Next() { |
| 69 | var title string | 69 | var title string |
| 70 | rows.Scan(&title) | 70 | rows.Scan(&title) |
diff --git a/backend/middleware/auth.go b/backend/middleware/auth.go index 0744b3d..6a057da 100644 --- a/backend/middleware/auth.go +++ b/backend/middleware/auth.go | |||
| @@ -45,7 +45,7 @@ func CheckAuth(c *gin.Context) { | |||
| 45 | } | 45 | } |
| 46 | // Get user titles from DB | 46 | // Get user titles from DB |
| 47 | user.Titles = []string{} | 47 | user.Titles = []string{} |
| 48 | rows, _ := database.DB.Query(`SELECT t.title_name FROM titles t WHERE t.user_id = $1`, user.SteamID) | 48 | rows, _ := database.DB.Query(`SELECT title_name FROM titles t INNER JOIN user_titles ut ON t.id=ut.title_id WHERE ut.user_id = $1`, user.SteamID) |
| 49 | for rows.Next() { | 49 | for rows.Next() { |
| 50 | var title string | 50 | var title string |
| 51 | rows.Scan(&title) | 51 | rows.Scan(&title) |