add: request + response interface changes
This commit is contained in:
@@ -5,6 +5,9 @@ export default async (req, res) => {
|
||||
const schema = Validator.object()
|
||||
.keys({
|
||||
q: Validator.string().required(),
|
||||
offset: Validator.number().optional(),
|
||||
limit: Validator.number().optional(),
|
||||
filter: Validator.any(),
|
||||
})
|
||||
.options({ allowUnknown: true })
|
||||
|
||||
@@ -14,15 +17,16 @@ export default async (req, res) => {
|
||||
}
|
||||
|
||||
try {
|
||||
const { q, ...options } = value
|
||||
const { q, offset, limit, filter, ...options } = value
|
||||
const paginationOptions = { offset, limit }
|
||||
|
||||
const searchService = req.scope.resolve("searchService")
|
||||
|
||||
const results = await searchService.search(
|
||||
ProductService.IndexName,
|
||||
q,
|
||||
options
|
||||
)
|
||||
const results = await searchService.search(ProductService.IndexName, q, {
|
||||
paginationOptions,
|
||||
filter,
|
||||
additionalOptions: options,
|
||||
})
|
||||
|
||||
res.status(200).send(results)
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user