fix парсер

This commit is contained in:
Artem Tsyrulnikov
2026-01-28 18:29:56 +03:00
parent 5910cf48dc
commit f23f489b22
7 changed files with 87 additions and 61 deletions

View File

@@ -18,9 +18,11 @@ func (d *Database) GetChannels(ctx context.Context) []domain.Channel {
title,
access_hash,
pts,
invite_link
invite_link,
is_accessible
FROM channel
WHERE deleted_at IS NULL;`
WHERE deleted_at IS NULL
AND is_accessible = true;`
txOrPool := transaction.TryExtractTX(ctx)
@@ -49,13 +51,14 @@ WHERE deleted_at IS NULL;`
}
type getChannelsDTO struct {
ID pgtype.UUID
TelegramID pgtype.Int8
Username pgtype.Text
Title pgtype.Text
AccessHash pgtype.Int8
Pts pgtype.Int4
InviteLink pgtype.Text
ID pgtype.UUID
TelegramID pgtype.Int8
Username pgtype.Text
Title pgtype.Text
AccessHash pgtype.Int8
Pts pgtype.Int4
InviteLink pgtype.Text
IsAccessible pgtype.Bool
}
func (dto *getChannelsDTO) destination() []any {
@@ -67,17 +70,19 @@ func (dto *getChannelsDTO) destination() []any {
&dto.AccessHash,
&dto.Pts,
&dto.InviteLink,
&dto.IsAccessible,
}
}
func (dto *getChannelsDTO) toDomain() domain.Channel {
return domain.Channel{
ID: dto.ID.Bytes,
TelegramID: domain.NormalizeChatID(dto.TelegramID.Int64),
Username: dto.Username.String,
Title: dto.Title.String,
AccessHash: dto.AccessHash.Int64,
Pts: int(dto.Pts.Int32),
InviteLink: dto.InviteLink.String,
ID: dto.ID.Bytes,
TelegramID: domain.NormalizeChatID(dto.TelegramID.Int64),
Username: dto.Username.String,
Title: dto.Title.String,
AccessHash: dto.AccessHash.Int64,
Pts: int(dto.Pts.Int32),
InviteLink: dto.InviteLink.String,
IsAccessible: dto.IsAccessible.Bool,
}
}