This commit is contained in:
2025-12-10 06:15:22 +00:00
parent 4dc9b4c0de
commit 1c939c54ff

View File

@@ -15,7 +15,7 @@ type CreatePostInput struct {
func (store *Store) GetPosts(ctx *gin.Context) { func (store *Store) GetPosts(ctx *gin.Context) {
var posts []models.Post var posts []models.Post
if err := store.DB.Find(&posts).Error; err != nil { if err := store.DB.Preload("Author").Find(&posts).Error; err != nil {
ctx.JSON(http.StatusInternalServerError, err.Error()) ctx.JSON(http.StatusInternalServerError, err.Error())
return return
} }