diff --git a/pkg/internal/models/subscriptions.go b/pkg/internal/models/subscriptions.go index b685d9e..6d78218 100644 --- a/pkg/internal/models/subscriptions.go +++ b/pkg/internal/models/subscriptions.go @@ -5,11 +5,8 @@ import "git.solsynth.dev/hypernet/nexus/pkg/nex/cruda" type Subscription struct { cruda.BaseModel - FollowerID uint `json:"follower_id"` - AccountID *uint `json:"account_id,omitempty"` - Account *Publisher `json:"account,omitempty"` - TagID *uint `json:"tag_id,omitempty"` - Tag Tag `json:"tag,omitempty"` - CategoryID *uint `json:"category_id,omitempty"` - Category Category `json:"category,omitempty"` + FollowerID uint `json:"follower_id"` + AccountID *uint `json:"account_id,omitempty"` + TagID *uint `json:"tag_id,omitempty"` + CategoryID *uint `json:"category_id,omitempty"` } diff --git a/pkg/internal/services/subscriptions.go b/pkg/internal/services/subscriptions.go index 30b8e6c..6b16763 100644 --- a/pkg/internal/services/subscriptions.go +++ b/pkg/internal/services/subscriptions.go @@ -144,7 +144,7 @@ func NotifyUserSubscription(poster models.Publisher, item models.Post, content s } var subscriptions []models.Subscription - if err := database.C.Where("account_id = ?", poster.ID).Preload("Follower").Find(&subscriptions).Error; err != nil { + if err := database.C.Where("account_id = ?", poster.ID).Find(&subscriptions).Error; err != nil { return fmt.Errorf("unable to get subscriptions: %v", err) } @@ -158,7 +158,7 @@ func NotifyUserSubscription(poster models.Publisher, item models.Post, content s userIDs := make([]uint64, 0, len(subscriptions)) for _, subscription := range subscriptions { - userIDs = append(userIDs, uint64(subscription.Follower.ID)) + userIDs = append(userIDs, uint64(subscription.FollowerID)) } if item.Visibility == models.PostVisibilitySelected { @@ -192,7 +192,7 @@ func NotifyTagSubscription(poster models.Tag, og models.Publisher, item models.P } var subscriptions []models.Subscription - if err := database.C.Where("tag_id = ?", poster.ID).Preload("Follower").Find(&subscriptions).Error; err != nil { + if err := database.C.Where("tag_id = ?", poster.ID).Find(&subscriptions).Error; err != nil { return fmt.Errorf("unable to get subscriptions: %v", err) } @@ -206,7 +206,7 @@ func NotifyTagSubscription(poster models.Tag, og models.Publisher, item models.P userIDs := make([]uint64, 0, len(subscriptions)) for _, subscription := range subscriptions { - userIDs = append(userIDs, uint64(subscription.Follower.ID)) + userIDs = append(userIDs, uint64(subscription.FollowerID)) } if item.Visibility == models.PostVisibilitySelected { @@ -240,7 +240,7 @@ func NotifyCategorySubscription(poster models.Category, og models.Publisher, ite } var subscriptions []models.Subscription - if err := database.C.Where("category_id = ?", poster.ID).Preload("Follower").Find(&subscriptions).Error; err != nil { + if err := database.C.Where("category_id = ?", poster.ID).Find(&subscriptions).Error; err != nil { return fmt.Errorf("unable to get subscriptions: %v", err) } @@ -254,7 +254,7 @@ func NotifyCategorySubscription(poster models.Category, og models.Publisher, ite userIDs := make([]uint64, 0, len(subscriptions)) for _, subscription := range subscriptions { - userIDs = append(userIDs, uint64(subscription.Follower.ID)) + userIDs = append(userIDs, uint64(subscription.FollowerID)) } if item.Visibility == models.PostVisibilitySelected {