diff --git a/internal/postgres/post.go b/internal/postgres/post.go index 1cd4472..1706b44 100644 --- a/internal/postgres/post.go +++ b/internal/postgres/post.go @@ -39,7 +39,14 @@ func CheckIfAnthrovePostNodeExistsByAnthroveID(ctx context.Context, db *gorm.DB, } func CheckIfAnthrovePostNodeExistsBySourceURL(ctx context.Context, db *gorm.DB, sourceURL string) (bool, error) { - return executeCheckQuery(ctx, db, "url = ?", sourceURL) + var size int64 + err := db.WithContext(ctx).Model(&pgModels.PostReference{}).Where("url = ?", sourceURL).Count(&size).Error + + if err != nil { + return false, err + } + + return size > 0, nil } func CheckIfAnthrovePostNodeExistsBySourceID(ctx context.Context, db *gorm.DB, sourceID string) (bool, error) {