Whoops!
This commit is contained in:
parent
85d498225e
commit
8d3f38fdd0
2 changed files with 2 additions and 1 deletions
|
@ -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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue