🐛 Fix list post didn't preload tags & categories
This commit is contained in:
parent
15d8449d2e
commit
74cfd7ed23
@ -113,6 +113,8 @@ func ListArticle(tx *gorm.DB, take int, offset int, noReact ...bool) ([]*models.
|
|||||||
if err := tx.
|
if err := tx.
|
||||||
Limit(take).Offset(offset).
|
Limit(take).Offset(offset).
|
||||||
Order("created_at DESC").
|
Order("created_at DESC").
|
||||||
|
Preload("Tags").
|
||||||
|
Preload("Categories").
|
||||||
Preload("Realm").
|
Preload("Realm").
|
||||||
Preload("Author").
|
Preload("Author").
|
||||||
Find(&items).Error; err != nil {
|
Find(&items).Error; err != nil {
|
||||||
|
@ -140,6 +140,8 @@ func ListPost(tx *gorm.DB, take int, offset int, noReact ...bool) ([]*models.Pos
|
|||||||
if err := tx.
|
if err := tx.
|
||||||
Limit(take).Offset(offset).
|
Limit(take).Offset(offset).
|
||||||
Order("created_at DESC").
|
Order("created_at DESC").
|
||||||
|
Preload("Tags").
|
||||||
|
Preload("Categories").
|
||||||
Preload("Realm").
|
Preload("Realm").
|
||||||
Preload("Author").
|
Preload("Author").
|
||||||
Preload("ReplyTo").
|
Preload("ReplyTo").
|
||||||
|
Loading…
Reference in New Issue
Block a user