Add /preview/* routes

This commit is contained in:
2024-06-12 00:35:06 +02:00
parent 64709920f7
commit 80b1351bd2
9 changed files with 924 additions and 102 deletions

View File

@@ -41,6 +41,16 @@ func (c Channel) WithSubscription(sub *Subscription) ChannelWithSubscription {
}
}
func (c Channel) JSONPreview() ChannelPreviewJSON {
return ChannelPreviewJSON{
ChannelID: c.ChannelID,
OwnerUserID: c.OwnerUserID,
InternalName: c.InternalName,
DisplayName: c.DisplayName,
DescriptionName: c.DescriptionName,
}
}
type ChannelWithSubscription struct {
Channel
Subscription *Subscription
@@ -74,6 +84,14 @@ type ChannelWithSubscriptionJSON struct {
Subscription *SubscriptionJSON `json:"subscription"`
}
type ChannelPreviewJSON struct {
ChannelID ChannelID `json:"channel_id"`
OwnerUserID UserID `json:"owner_user_id"`
InternalName string `json:"internal_name"`
DisplayName string `json:"display_name"`
DescriptionName *string `json:"description_name"`
}
type ChannelDB struct {
ChannelID ChannelID `db:"channel_id"`
OwnerUserID UserID `db:"owner_user_id"`