From c7d0b3456d40de9f62fc86e6b670b1792e447c44 Mon Sep 17 00:00:00 2001 From: Nabil Ould Hamou Date: Fri, 1 Mar 2024 23:03:40 +0100 Subject: [PATCH] fix: bug lors d'un get users --- controllers/userController.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/userController.go b/controllers/userController.go index 8483b68..ea67416 100644 --- a/controllers/userController.go +++ b/controllers/userController.go @@ -61,7 +61,7 @@ func GetUserById(c *gin.Context) { } var user models.User - result := initializers.DB.First(&user, "id = ?", uniqueId) + result := initializers.DB.Preload("Posts").First(&user, "id = ?", uniqueId) if result.Error != nil { if errors.Is(result.Error, gorm.ErrRecordNotFound) {