diff --git a/src/lib/server/prisma.ts b/src/lib/server/prisma.ts index 41f19932..af33d610 100644 --- a/src/lib/server/prisma.ts +++ b/src/lib/server/prisma.ts @@ -257,7 +257,8 @@ export const searchPosts = async ( title: { contains: query }, - authorId: userId + authorId: userId, + visibility: userId ? undefined : "public" }, { files: { @@ -267,6 +268,7 @@ export const searchPosts = async ( } } }, + visibility: userId ? undefined : "public", authorId: userId } ] diff --git a/src/pages/api/post/search.ts b/src/pages/api/post/search.ts index e8354739..65aeead7 100644 --- a/src/pages/api/post/search.ts +++ b/src/pages/api/post/search.ts @@ -26,9 +26,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => { } const posts = await searchPosts(searchQuery, { - userId, - withFiles: true, - publicOnly: false + userId }) return res.json(posts)