This commit is contained in:
Atridad Lahiji 2024-06-28 10:40:24 -06:00
parent 85d498225e
commit 8d3f38fdd0
No known key found for this signature in database
2 changed files with 2 additions and 1 deletions

View file

@ -27,6 +27,7 @@ func RegisterUserHandler(c echo.Context) error {
} }
user := lib.User{Name: name, Email: email, Password: hashedPassword} user := lib.User{Name: name, Email: email, Password: hashedPassword}
println("User: ", user.Name, user.Email, user.Password)
if err := lib.SaveUser(lib.GetDBPool(), &user); err != nil { if err := lib.SaveUser(lib.GetDBPool(), &user); err != nil {
return c.JSON(http.StatusInternalServerError, "Failed to save user") return c.JSON(http.StatusInternalServerError, "Failed to save user")
} }

View file

@ -65,7 +65,7 @@ func SaveUser(dbPool *pgxpool.Pool, user *User) error {
return errors.New("database connection pool is not initialized") return errors.New("database connection pool is not initialized")
} }
commandTag, err := dbPool.Exec(context.Background(), "INSERT INTO users (email, password) VALUES ($1, $2)", user.Email, user.Password) commandTag, err := dbPool.Exec(context.Background(), "INSERT INTO users (name, email, password) VALUES ($1, $2, $3)", user.Name, user.Email, user.Password)
if err != nil { if err != nil {
return err return err
} }