123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- package common
- import (
- "encoding/json"
- "time"
- "github.com/google/uuid"
- "gorm.io/gorm"
- )
- // Platform represents supported social media platforms
- type Platform string
- const (
- PlatformInstagram Platform = "instagram"
- PlatformTikTok Platform = "tiktok"
- PlatformYoutube Platform = "youtube"
- )
- // String converts Platform to string
- func (p Platform) String() string {
- return string(p)
- }
- // TrendAnalysis represents a trend analysis result
- type TrendAnalysis struct {
- ID uuid.UUID `gorm:"type:uuid;primary_key" json:"id"`
- ProfileID uuid.UUID `gorm:"type:uuid" json:"profile_id"`
- Type string `gorm:"not null" json:"type"` // social, google, audience
- Data json.RawMessage `gorm:"type:jsonb" json:"data"`
- CreatedAt time.Time `json:"created_at"`
- UpdatedAt time.Time `json:"updated_at"`
- DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
- }
- // SocialProfile represents a social media profile
- type SocialProfile struct {
- ID uuid.UUID `gorm:"type:uuid;primary_key" json:"id"`
- Platform string `gorm:"not null" json:"platform"`
- Username string `gorm:"not null" json:"username"`
- ProfileURL string `gorm:"not null" json:"profile_url"`
- FollowerCount int64 `json:"follower_count"`
- Engagement float64 `json:"engagement"`
- CreatedAt time.Time `json:"created_at"`
- UpdatedAt time.Time `json:"updated_at"`
- DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
- }
- // AudienceInsight represents audience analysis data
- type AudienceInsight struct {
- ID uuid.UUID `gorm:"type:uuid;primary_key" json:"id"`
- ProfileID uuid.UUID `gorm:"type:uuid" json:"profile_id"`
- Demographics json.RawMessage `gorm:"type:jsonb" json:"demographics"`
- Interests json.RawMessage `gorm:"type:jsonb" json:"interests"`
- ActivityTimes json.RawMessage `gorm:"type:jsonb" json:"activity_times"`
- CreatedAt time.Time `json:"created_at"`
- UpdatedAt time.Time `json:"updated_at"`
- DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
- }
- // GoogleTrend represents Google Trends data
- type GoogleTrend struct {
- ID uuid.UUID `gorm:"type:uuid;primary_key" json:"id"`
- Keywords []string `gorm:"type:text[]" json:"keywords"`
- TrendData json.RawMessage `gorm:"type:jsonb" json:"trend_data"`
- StartDate time.Time `json:"start_date"`
- EndDate time.Time `json:"end_date"`
- CreatedAt time.Time `json:"created_at"`
- UpdatedAt time.Time `json:"updated_at"`
- DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
- }
- type ContentTrend struct {
- TrendType TrendType `json:"trend_type"`
- Items []TrendItem `json:"items"`
- Timeframe string `json:"timeframe"`
- Platform Platform `json:"platform"`
- }
- type TrendType string
- const (
- TrendTypeHashtags TrendType = "hashtags"
- TrendTypeKeywords TrendType = "keywords"
- TrendTypeTopics TrendType = "topics"
- TrendTypePhrases TrendType = "phrases"
- TrendTypeMusicTracks TrendType = "music_tracks"
- TrendTypeChallenges TrendType = "challenges"
- )
- type TrendItem struct {
- Value string `json:"value"`
- Frequency int `json:"frequency"`
- GrowthRate float64 `json:"growth_rate"`
- Examples []string `json:"examples"`
- FirstSeen time.Time `json:"first_seen"`
- }
- type ProductSuggestion struct {
- ID uuid.UUID `gorm:"type:uuid;primary_key" json:"id"`
- UserID string `gorm:"not null" json:"user_id"`
- Name string `json:"name"`
- Description string `json:"description"`
- TargetAudience string `json:"target_audience"`
- RelevanceScore float64 `json:"relevance_score"`
- SuccessFactors []string `gorm:"type:text[]" json:"success_factors"`
- CreatedAt time.Time `json:"created_at"`
- UpdatedAt time.Time `json:"updated_at"`
- DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
- }
- type TrendQuery struct {
- Platform *Platform `form:"platform"`
- TrendTypes []TrendType `form:"trend_types"`
- Timeframe *string `form:"timeframe"`
- }
- type GetSuggestionsRequest struct {
- UserID string `json:"user_id"`
- Socials []Social `json:"socials"`
- }
- type Social struct {
- Platform Platform `json:"platform"`
- Username string `json:"username"`
- }
|