From c6dff3459908cbe8bcf731fad93a72e9f2165656 Mon Sep 17 00:00:00 2001 From: Sargam Date: Sat, 5 Oct 2024 04:32:49 +0545 Subject: [PATCH] Revert "feat/search: Added search bar and other minor ui fix" (#1427) This reverts commit 700e6b14d107383ce489f6a125798691944e2122. --- src/app/api/search/route.ts | 16 ---------------- src/app/courses/[courseId]/layout.tsx | 6 +----- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/src/app/api/search/route.ts b/src/app/api/search/route.ts index 2c16770f9..84c9643c4 100644 --- a/src/app/api/search/route.ts +++ b/src/app/api/search/route.ts @@ -3,8 +3,6 @@ import db from '@/db'; import { CourseContent } from '@prisma/client'; import Fuse from 'fuse.js'; import { NextRequest, NextResponse } from 'next/server'; -import { getServerSession } from 'next-auth'; -import { authOptions } from '@/lib/auth'; export type TSearchedVideos = { id: number; @@ -26,7 +24,6 @@ const fuzzySearch = (videos: TSearchedVideos[], searchQuery: string) => { export async function GET(request: NextRequest) { const { searchParams } = new URL(request.url); const searchQuery = searchParams.get('q'); - const session = await getServerSession(authOptions); if (searchQuery && searchQuery.length > 2) { const value: TSearchedVideos[] = await cache.get( @@ -42,19 +39,6 @@ export async function GET(request: NextRequest) { where: { type: 'video', hidden: false, - parent: { - courses: { - some: { - course: { - purchasedBy: { - some: { - userId: session?.user?.id, - }, - }, - }, - }, - }, - }, }, select: { id: true, diff --git a/src/app/courses/[courseId]/layout.tsx b/src/app/courses/[courseId]/layout.tsx index e6c279ddd..f134db9b4 100644 --- a/src/app/courses/[courseId]/layout.tsx +++ b/src/app/courses/[courseId]/layout.tsx @@ -1,5 +1,4 @@ import { QueryParams } from '@/actions/types'; -import SearchBar from '@/components/search/SearchBar'; import { Sidebar } from '@/components/Sidebar'; import { getFullCourseContent } from '@/db/course'; import { authOptions } from '@/lib/auth'; @@ -50,10 +49,7 @@ const Layout = async ({ return (
-
- - -
+ {children}
);