Forgot to fetch Name

This commit is contained in:
Atridad Lahiji 2024-06-28 10:44:24 -06:00
parent 8d3f38fdd0
commit bf62a62978
No known key found for this signature in database

View file

@ -37,7 +37,7 @@ func GetUserByEmail(dbPool *pgxpool.Pool, email string) (*User, error) {
var user User
// Ensure the ID is being scanned as a string.
err := dbPool.QueryRow(context.Background(), "SELECT id::text, email, password FROM users WHERE email = $1", email).Scan(&user.ID, &user.Email, &user.Password)
err := dbPool.QueryRow(context.Background(), "SELECT id::text, name, email, password FROM users WHERE email = $1", email).Scan(&user.ID, &user.Name, &user.Email, &user.Password)
if err != nil {
return nil, err
}
@ -52,7 +52,7 @@ func GetUserByID(dbPool *pgxpool.Pool, id string) (*User, error) {
var user User
// Ensure the ID is being scanned as a string.
err := dbPool.QueryRow(context.Background(), "SELECT id::text, email, password FROM users WHERE id = $1", id).Scan(&user.ID, &user.Email, &user.Password)
err := dbPool.QueryRow(context.Background(), "SELECT id::text, name, email, password FROM users WHERE id = $1", id).Scan(&user.ID, &user.Name, &user.Email, &user.Password)
if err != nil {
return nil, err
}