Skip to content

Commit

Permalink
fix: remove insert trigger on users, check insert user on login err (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
pektezol authored Nov 1, 2024
1 parent e731f58 commit bc65aaa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/database/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ CREATE TABLE users (
);

CREATE TRIGGER "users"
AFTER INSERT OR UPDATE OR DELETE ON "users"
AFTER UPDATE OR DELETE ON "users"
FOR EACH ROW EXECUTE FUNCTION log_audit();

CREATE TABLE games (
Expand Down
6 changes: 5 additions & 1 deletion backend/handlers/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@ func Login(c *gin.Context) {
user.LocCountryCode = "XX"
}
// Insert new user to database
database.DB.Exec(`INSERT INTO users (steam_id, user_name, avatar_link, country_code)
_, err = database.DB.Exec(`INSERT INTO users (steam_id, user_name, avatar_link, country_code)
VALUES ($1, $2, $3, $4)`, steamID, user.PersonaName, user.AvatarFull, user.LocCountryCode)
if err != nil {
c.JSON(http.StatusOK, models.ErrorResponse(err.Error()))
return
}
}
moderator := false
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)
Expand Down

0 comments on commit bc65aaa

Please sign in to comment.