feat: added references in posts
Signed-off-by: SoXX <soxx@fenpa.ws>
This commit is contained in:
parent
63f8902674
commit
c3ca361506
@ -252,7 +252,7 @@ func GetUserFavoriteWithPagination(ctx context.Context, db *gorm.DB, anthroveUse
|
|||||||
|
|
||||||
for _, userFavorite := range userFavorites {
|
for _, userFavorite := range userFavorites {
|
||||||
var post models.Post
|
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 err != nil {
|
||||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
return nil, &otterError.NoDataFound{}
|
return nil, &otterError.NoDataFound{}
|
||||||
|
Reference in New Issue
Block a user