feat: add MongoDB search method, endpoints, and settings module
deploy-chabokan / deploy (push) Canceled after 0s
deploy-chabokan / deploy (push) Canceled after 0s
This commit is contained in:
@@ -3,7 +3,7 @@ const propertyService = require('./propertyService')
|
||||
const { eventEmitter } = require('../../events/eventEmitter')
|
||||
|
||||
exports.searchProperties = catchAsync(async (req, res, next) => {
|
||||
const { facets, belongings, totalCount, pagesCount } = await propertyService.searchProperties(req.query)
|
||||
const { facets, belongings, totalCount, pagesCount, searchEngine } = await propertyService.searchProperties(req.query)
|
||||
|
||||
res.status(200).json({
|
||||
status: 'success',
|
||||
@@ -11,9 +11,24 @@ exports.searchProperties = catchAsync(async (req, res, next) => {
|
||||
properties: belongings,
|
||||
totalCount,
|
||||
pagesCount,
|
||||
searchEngine,
|
||||
})
|
||||
})
|
||||
|
||||
exports.searchPropertiesMongo = catchAsync(async (req, res, next) => {
|
||||
const { facets, belongings, totalCount, pagesCount, searchEngine } = await propertyService.searchPropertiesMongo(req.query)
|
||||
|
||||
res.status(200).json({
|
||||
status: 'success',
|
||||
facets,
|
||||
properties: belongings,
|
||||
totalCount,
|
||||
pagesCount,
|
||||
searchEngine: searchEngine || 'mongo',
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
exports.indexAllProperties = catchAsync(async (req, res, next) => {
|
||||
const { indexedCount } = await propertyService.indexAllProperties()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user