From 4da487c51f535f2f54e7f1220dd758e3f5460168 Mon Sep 17 00:00:00 2001 From: Artem Tsyrulnikov Date: Thu, 22 Jan 2026 15:00:59 +0300 Subject: [PATCH] fix --- tg_parser/internal/adapter/database/update_channel.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tg_parser/internal/adapter/database/update_channel.go b/tg_parser/internal/adapter/database/update_channel.go index 286503a..fc25b69 100644 --- a/tg_parser/internal/adapter/database/update_channel.go +++ b/tg_parser/internal/adapter/database/update_channel.go @@ -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},