From c4683e6bd0e6ac7d94da082702b09fea37e531d9 Mon Sep 17 00:00:00 2001 From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> Date: Thu, 20 Apr 2023 20:40:24 +0300 Subject: fix: empty country code on user creation (#36) --- backend/controllers/loginController.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'backend/controllers/loginController.go') diff --git a/backend/controllers/loginController.go b/backend/controllers/loginController.go index 84ef22f..3e59211 100644 --- a/backend/controllers/loginController.go +++ b/backend/controllers/loginController.go @@ -50,6 +50,10 @@ func Login(c *gin.Context) { c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) return } + // Empty country code check + if user.LocCountryCode == "" { + user.LocCountryCode = "XX" + } // Insert new user to database database.DB.Exec(`INSERT INTO users (steam_id, username, avatar_link, country_code) VALUES ($1, $2, $3, $4)`, steamID, user.PersonaName, user.AvatarFull, user.LocCountryCode) -- cgit v1.2.3