From 42fa4d23e0d15ea41844595666772c66f9dc0e3a Mon Sep 17 00:00:00 2001 From: Nabil Ould Hamou Date: Thu, 7 Mar 2024 05:24:34 +0100 Subject: [PATCH] fix: n'envoie pas l'avatar lors du get many --- controllers/userController.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/userController.go b/controllers/userController.go index 7b3dd89..332ae78 100644 --- a/controllers/userController.go +++ b/controllers/userController.go @@ -34,9 +34,9 @@ func GetUsers(c *gin.Context) { var result *gorm.DB if username != "" { - result = initializers.DB.Where("username LIKE ?", username+"%").Offset(offset).Limit(20).Find(&users) + result = initializers.DB.Preload("Avatar").Where("username LIKE ?", username+"%").Offset(offset).Limit(20).Find(&users) } else { - result = initializers.DB.Offset(offset).Limit(20).Find(&users) + result = initializers.DB.Preload("Avatar").Offset(offset).Limit(20).Find(&users) } if result.Error != nil {