Re-implement public search

This commit is contained in:
Max Leiter 2023-01-13 00:17:50 -08:00
parent ba092152f2
commit 16b4a5ae07
2 changed files with 4 additions and 4 deletions

View file

@ -257,7 +257,8 @@ export const searchPosts = async (
title: { title: {
contains: query contains: query
}, },
authorId: userId authorId: userId,
visibility: userId ? undefined : "public"
}, },
{ {
files: { files: {
@ -267,6 +268,7 @@ export const searchPosts = async (
} }
} }
}, },
visibility: userId ? undefined : "public",
authorId: userId authorId: userId
} }
] ]

View file

@ -26,9 +26,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
} }
const posts = await searchPosts(searchQuery, { const posts = await searchPosts(searchQuery, {
userId, userId
withFiles: true,
publicOnly: false
}) })
return res.json(posts) return res.json(posts)