fix: bug lors d'un get users

This commit is contained in:
Nabil Ould Hamou 2024-03-01 23:03:40 +01:00
parent fd3c48d418
commit c7d0b3456d
No known key found for this signature in database
GPG key ID: 2B1AE73E9B6014EF

View file

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