Fix post searching
This commit is contained in:
parent
e49ca2e749
commit
5b7efc8a06
2 changed files with 3 additions and 16 deletions
|
@ -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
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue