Skip to content

Commit 0c22148

Browse files
committed
fix: use Unscoped delete for ErrUnlikePostById to remove likes permanently
1 parent cf9c783 commit 0c22148

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

repository/likes_repository.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func (r *likesRepository) ErrUnlikePostById(ctx context.Context, tx *gorm.DB, po
6969
PostID: postId,
7070
}
7171

72-
if err := tx.WithContext(ctx).Where("user_id = ? AND post_id = ?", userId, postId).Delete(&likes).Error; err != nil {
72+
if err := tx.WithContext(ctx).Where("user_id = ? AND post_id = ?", userId, postId).Unscoped().Delete(&likes).Error; err != nil {
7373
return err
7474
}
7575

0 commit comments

Comments
 (0)