fix: n'envoie pas l'avatar lors du get many

This commit is contained in:
Nabil Ould Hamou 2024-03-07 05:24:34 +01:00
parent bcdff48057
commit 42fa4d23e0
No known key found for this signature in database
GPG key ID: 2B1AE73E9B6014EF

View file

@ -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 {