🐛 Fix list post didn't preload tags & categories

This commit is contained in:
LittleSheep 2024-07-07 11:58:30 +08:00
parent 15d8449d2e
commit 74cfd7ed23
2 changed files with 4 additions and 0 deletions

View File

@ -113,6 +113,8 @@ func ListArticle(tx *gorm.DB, take int, offset int, noReact ...bool) ([]*models.
if err := tx.
Limit(take).Offset(offset).
Order("created_at DESC").
Preload("Tags").
Preload("Categories").
Preload("Realm").
Preload("Author").
Find(&items).Error; err != nil {

View File

@ -140,6 +140,8 @@ func ListPost(tx *gorm.DB, take int, offset int, noReact ...bool) ([]*models.Pos
if err := tx.
Limit(take).Offset(offset).
Order("created_at DESC").
Preload("Tags").
Preload("Categories").
Preload("Realm").
Preload("Author").
Preload("ReplyTo").