From 5b7efc8a063effb296687ddfc1a9d6855880af05 Mon Sep 17 00:00:00 2001 From: Max Leiter Date: Fri, 13 Jan 2023 00:01:32 -0800 Subject: [PATCH] Fix post searching --- src/lib/server/prisma.ts | 11 +++-------- src/pages/api/post/search.ts | 8 -------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/src/lib/server/prisma.ts b/src/lib/server/prisma.ts index 2d30cec0..c249b2b2 100644 --- a/src/lib/server/prisma.ts +++ b/src/lib/server/prisma.ts @@ -259,10 +259,9 @@ export const searchPosts = async ( OR: [ { title: { - search: query + contains: query }, - authorId: userId, - visibility: publicOnly ? "public" : undefined + authorId: userId }, { files: { @@ -272,13 +271,9 @@ export const searchPosts = async ( } } }, - authorId: userId, - visibility: publicOnly ? "public" : undefined + authorId: userId } ] - }, - include: { - files: withFiles } }) diff --git a/src/pages/api/post/search.ts b/src/pages/api/post/search.ts index 129c5c9b..e8354739 100644 --- a/src/pages/api/post/search.ts +++ b/src/pages/api/post/search.ts @@ -10,14 +10,6 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => { const publicSearch = parseQueryParam(query.public) const searchQuery = parseQueryParam(q) - console.log( - "searchQuery", - searchQuery, - "publicSearch", - publicSearch, - "userId", - query.userId - ) if (!searchQuery) { res.status(400).json({ error: "Invalid query" }) return