BUG FIX: in searchBelongings req.query passed to the service

This commit is contained in:
MohammadHMazarei
2025-04-22 12:59:02 +03:30
parent 5ce201c4e4
commit 46e3c4858d
+6 -4
View File
@@ -2,11 +2,14 @@ const catchAsync = require('../../globalErrorHandler/catchAsync')
const belongingService = require('./belongingService') const belongingService = require('./belongingService')
exports.searchBelongings = catchAsync(async (req, res, next) => { exports.searchBelongings = catchAsync(async (req, res, next) => {
const {facets, belongings, totalCount, pagesCount} = await belongingService.searchBelongings() const { facets, belongings, totalCount, pagesCount } = await belongingService.searchBelongings(req.query)
res.status(200).json({ res.status(200).json({
status: 'success', status: 'success',
facets, belongings, totalCount, pagesCount facets,
belongings,
totalCount,
pagesCount,
}) })
}) })
@@ -15,11 +18,10 @@ exports.indexAllBelongings = catchAsync(async (req, res, next) => {
res.status(200).json({ res.status(200).json({
status: 'success', status: 'success',
indexedCount indexedCount,
}) })
}) })
exports.getAllBelongings = catchAsync(async (req, res, next) => { exports.getAllBelongings = catchAsync(async (req, res, next) => {
const belongings = await belongingService.getAllBelongings() const belongings = await belongingService.getAllBelongings()