diff --git a/pkg/internal/models/publishers.go b/pkg/internal/models/publishers.go index 7808751..10876b8 100644 --- a/pkg/internal/models/publishers.go +++ b/pkg/internal/models/publishers.go @@ -30,6 +30,6 @@ type Publisher struct { RealmID *uint `json:"realm_id"` AccountID *uint `json:"account_id"` - Account models.Account `gorm:"-"` - Realm models.Realm `gorm:"-"` + Account models.Account `gorm:"-" json:"realm"` + Realm models.Realm `gorm:"-" json:"realm"` } diff --git a/pkg/internal/services/queries/posts.go b/pkg/internal/services/queries/posts.go index f0e983f..5deb937 100644 --- a/pkg/internal/services/queries/posts.go +++ b/pkg/internal/services/queries/posts.go @@ -111,7 +111,7 @@ func ListPostV2(tx *gorm.DB, take int, offset int, order any, user *uint) ([]mod } // Putting information back to data - for _, item := range posts { + for idx, item := range posts { var this []fmodels.Attachment if val, ok := item.Body["attachments"].([]string); ok && len(val) > 0 { this = lo.Filter(attachments, func(item fmodels.Attachment, _ int) bool { @@ -125,6 +125,7 @@ func ListPostV2(tx *gorm.DB, take int, offset int, order any, user *uint) ([]mod } return acc.ID == *item.Publisher.AccountID }) + posts[idx] = item } // Add post views for the user