Fix post searching

This commit is contained in:
Max Leiter 2023-01-13 00:01:32 -08:00
parent e49ca2e749
commit 5b7efc8a06
2 changed files with 3 additions and 16 deletions

View file

@ -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
}
})

View file

@ -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