This commit is contained in:
Artem Tsyrulnikov
2026-01-22 15:00:59 +03:00
parent 3b66ca329f
commit 4da487c51f

View File

@@ -3,6 +3,7 @@ package database
import (
"context"
"fmt"
"strings"
"github.com/jackc/pgx/v5/pgtype"
@@ -22,10 +23,13 @@ WHERE id = $1;`
txOrPool := transaction.TryExtractTX(ctx)
username := strings.TrimSpace(channel.Username)
usernameValid := username != ""
dto := updateChannelDTO{
ID: pgtype.UUID{Bytes: channel.ID, Valid: true},
TelegramID: pgtype.Int8{Int64: channel.TelegramID, Valid: true},
Username: pgtype.Text{String: channel.Username, Valid: true},
Username: pgtype.Text{String: username, Valid: usernameValid},
Title: pgtype.Text{String: channel.Title, Valid: true},
AccessHash: pgtype.Int8{Int64: channel.AccessHash, Valid: true},
Pts: pgtype.Int4{Int32: int32(channel.Pts), Valid: true},