From c3ca361506ad0b2c156ebc3646f9d4d6f2ed47bd Mon Sep 17 00:00:00 2001 From: SoXX Date: Mon, 15 Jul 2024 15:37:21 +0200 Subject: [PATCH] feat: added references in posts Signed-off-by: SoXX --- internal/postgres/user.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/postgres/user.go b/internal/postgres/user.go index d6c3769..3cf9fb8 100644 --- a/internal/postgres/user.go +++ b/internal/postgres/user.go @@ -252,7 +252,7 @@ func GetUserFavoriteWithPagination(ctx context.Context, db *gorm.DB, anthroveUse for _, userFavorite := range userFavorites { var post models.Post - err = db.WithContext(ctx).Model(&models.Post{}).Where("id = ?", userFavorite.PostID).First(&post).Error + err = db.WithContext(ctx).Model(&models.Post{}).Joins("References").Where("id = ?", userFavorite.PostID).First(&post).Error if err != nil { if errors.Is(err, gorm.ErrRecordNotFound) { return nil, &otterError.NoDataFound{}