revork structures for hub

This commit is contained in:
2026-04-25 16:04:53 +02:00
parent 635139aad2
commit df1e969d49
9 changed files with 165 additions and 157 deletions
+5 -6
View File
@@ -95,7 +95,7 @@ func UserGetStandardInfoByName(ctx context.Context, user *types.User) error {
var rgba int64
err := dbConn.QueryRow(ctx, `
SELECT id, name, pass_hash, COALESCE(pronouns, ''), rgba, created_at, COALESCE(avatar, ''), COALESCE(profile_bg, '') FROM users WHERE name = $1
`, user.Name).Scan(&user.Id, &user.Name, &user.PasswordHash, &user.Pronouns, &rgba, &user.CreatedAt, &user.Avatar, &user.ProfileBg)
`, user.Name).Scan(&user.Id, &user.Name, &user.PasswordHash, &user.Pronouns, &rgba, &user.CreatedAt, &user.AvatarUrl, &user.ProfileBgUrl)
if err == nil {
user.Color = convertions.Uint32ToRgba(uint32(rgba))
}
@@ -106,7 +106,7 @@ func UserGetById(ctx context.Context, user *types.User) error {
var rgba int64
err := dbConn.QueryRow(ctx, `
SELECT name, pass_hash, COALESCE(pronouns, ''), rgba, created_at, COALESCE(avatar, ''), COALESCE(profile_bg, '') FROM users WHERE id = $1
`, user.Id).Scan(&user.Name, &user.PasswordHash, &user.Pronouns, &rgba, &user.CreatedAt, &user.Avatar, &user.ProfileBg)
`, user.Id).Scan(&user.Name, &user.PasswordHash, &user.Pronouns, &rgba, &user.CreatedAt, &user.AvatarUrl, &user.ProfileBgUrl)
if err == nil {
user.Color = convertions.Uint32ToRgba(uint32(rgba))
}
@@ -135,12 +135,12 @@ func UserUpdateProfile(ctx context.Context, user *types.User, updateList types.U
}
if updateList.Avatar {
setClauses = append(setClauses, fmt.Sprintf("avatar = $%d", argIdx))
args = append(args, user.Avatar)
args = append(args, user.AvatarUrl)
argIdx++
}
if updateList.ProfileBg {
setClauses = append(setClauses, fmt.Sprintf("profile_bg = $%d", argIdx))
args = append(args, user.ProfileBg)
args = append(args, user.ProfileBgUrl)
argIdx++
}
@@ -197,7 +197,7 @@ func ConnectionsGetBelongingToUser(ctx context.Context, user *types.User) error
}
for rows.Next() {
conn := types.CreateConn()
conn := types.NewConn()
if err = rows.Scan(&conn.Id, &conn.RequestorId, &conn.RecipientId, &conn.State, &conn.CreatedAt); err != nil {
return fmt.Errorf("scanning connection row: %w", err)
}
@@ -254,4 +254,3 @@ func ConnectionGetMessagesBefore(ctx context.Context, before time.Time, connecti
}
return messages, rows.Err()
}