приватные каналы

This commit is contained in:
Artem Tsyrulnikov
2026-01-21 02:41:20 +03:00
parent 233afb5451
commit b5695360c2
27 changed files with 1026 additions and 217 deletions

View File

@@ -17,7 +17,8 @@ func (d *Database) GetChannels(ctx context.Context) []domain.Channel {
username,
title,
access_hash,
pts
pts,
invite_link
FROM channel
WHERE deleted_at IS NULL;`
@@ -54,6 +55,7 @@ type getChannelsDTO struct {
Title pgtype.Text
AccessHash pgtype.Int8
Pts pgtype.Int4
InviteLink pgtype.Text
}
func (dto *getChannelsDTO) destination() []any {
@@ -64,6 +66,7 @@ func (dto *getChannelsDTO) destination() []any {
&dto.Title,
&dto.AccessHash,
&dto.Pts,
&dto.InviteLink,
}
}
@@ -75,5 +78,6 @@ func (dto *getChannelsDTO) toDomain() domain.Channel {
Title: dto.Title.String,
AccessHash: dto.AccessHash.Int64,
Pts: int(dto.Pts.Int32),
InviteLink: dto.InviteLink.String,
}
}

View File

@@ -17,7 +17,8 @@ func (d *Database) GetChannelsWithTrackedPosts(ctx context.Context) ([]domain.Ch
c.username,
c.title,
c.access_hash,
c.pts
c.pts,
c.invite_link
FROM channel c
INNER JOIN placement p ON p.channel_id = c.id
INNER JOIN placement_post pp ON pp.placement_id = p.id
@@ -55,6 +56,7 @@ type getChannelsWithTrackedPostsDTO struct {
Title pgtype.Text
AccessHash pgtype.Int8
Pts pgtype.Int4
InviteLink pgtype.Text
}
func (dto *getChannelsWithTrackedPostsDTO) destination() []any {
@@ -65,6 +67,7 @@ func (dto *getChannelsWithTrackedPostsDTO) destination() []any {
&dto.Title,
&dto.AccessHash,
&dto.Pts,
&dto.InviteLink,
}
}
@@ -76,5 +79,6 @@ func (dto *getChannelsWithTrackedPostsDTO) toDomain() domain.Channel {
Title: dto.Title.String,
AccessHash: dto.AccessHash.Int64,
Pts: int(dto.Pts.Int32),
InviteLink: dto.InviteLink.String,
}
}