add fixes for db and http
This commit is contained in:
+3
-3
@@ -19,7 +19,7 @@ func DbInit(ctx context.Context) {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
_, err = dbConn.Exec(ctx, `CREATE EXTENSION IF NOT EXISTS "gen_random_uuid";`)
|
||||
_, err = dbConn.Exec(ctx, `CREATE EXTENSION IF NOT EXISTS "pgcrypto";`)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -116,14 +116,14 @@ func DbUserDelete(ctx context.Context, id uint32) error {
|
||||
|
||||
func DbUserGetStandardInfoByName(ctx context.Context, user *User) error {
|
||||
err := dbConn.QueryRow(ctx, `
|
||||
SELECT id, name, pass_hash, pronouns, color_red, color_green, color_blue, created_at FROM users WHERE name = $1
|
||||
SELECT id, name, pass_hash, COALESCE(pronouns, ''), color_red, color_green, color_blue, created_at FROM users WHERE name = $1
|
||||
`, user.Name).Scan(&user.Id, &user.Name, &user.PasswordHash, &user.Pronouns, &user.Color[0], &user.Color[1], &user.Color[2], &user.CreatedAt)
|
||||
return err
|
||||
}
|
||||
|
||||
func DbUserGetById(ctx context.Context, user *User) error {
|
||||
err := dbConn.QueryRow(ctx, `
|
||||
SELECT name, pass_hash, pronouns, color_red, color_green, color_blue, created_at FROM users WHERE id = $1
|
||||
SELECT name, pass_hash, COALESCE(pronouns, ''), color_red, color_green, color_blue, created_at FROM users WHERE id = $1
|
||||
`, user.Id).Scan(&user.Name, &user.PasswordHash, &user.Pronouns, &user.Color[0], &user.Color[1], &user.Color[2], &user.CreatedAt)
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user