Post with categories and tags

This commit is contained in:
2024-02-04 20:13:06 +08:00
parent 86783316a1
commit 28b4f11ccf
5 changed files with 161 additions and 8 deletions

View File

@ -19,12 +19,18 @@ func ListPost(tx *gorm.DB, take int, offset int) ([]*models.Post, error) {
Offset(offset).
Preload("Author").
Preload("Attachments").
Preload("Categories").
Preload("Tags").
Preload("RepostTo").
Preload("ReplyTo").
Preload("RepostTo.Author").
Preload("ReplyTo.Author").
Preload("RepostTo.Attachments").
Preload("ReplyTo.Attachments").
Preload("RepostTo.Categories").
Preload("ReplyTo.Categories").
Preload("RepostTo.Tags").
Preload("ReplyTo.Tags").
Find(&posts).Error; err != nil {
return posts, err
}