Files
tgex-backend/tg_parser/internal/domain/post.go
2026-01-21 02:41:20 +03:00

32 lines
535 B
Go

package domain
import (
"fmt"
"github.com/google/uuid"
)
type Post struct {
ID uuid.UUID
ChannelID uuid.UUID
MessageID int
Text string
Link string
Views int
}
func NewPost(channel Channel, messageID int, text string, views int) Post {
link := ""
if channel.Username != "" {
link = fmt.Sprintf("https://t.me/%s/%d", channel.Username, messageID)
}
return Post{
ID: uuid.New(),
ChannelID: channel.ID,
MessageID: messageID,
Text: text,
Link: link,
Views: views,
}
}