Re-implement public search
This commit is contained in:
parent
ba092152f2
commit
16b4a5ae07
2 changed files with 4 additions and 4 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue