From 69555bfbad109f773af66132fe896005d21c974c Mon Sep 17 00:00:00 2001 From: aelassas Date: Mon, 27 Jan 2025 13:40:31 +0100 Subject: [PATCH] Fix: sorting logic in car retrieval functions --- api/src/controllers/carController.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/src/controllers/carController.ts b/api/src/controllers/carController.ts index 1a6196f8a..a58758653 100644 --- a/api/src/controllers/carController.ts +++ b/api/src/controllers/carController.ts @@ -555,7 +555,7 @@ export const getCars = async (req: Request, res: Response) => { { $facet: { resultData: [{ $sort: { updatedAt: -1, _id: 1 } }, { $skip: (page - 1) * size }, { $limit: size }], - // resultData: [{ $sort: { price: 1, _id: 1 } }, { $skip: (page - 1) * size }, { $limit: size }], + // resultData: [{ $sort: { dailyPrice: 1, _id: 1 } }, { $skip: (page - 1) * size }, { $limit: size }], pageInfo: [ { $count: 'totalRecords', @@ -771,7 +771,7 @@ export const getFrontendCars = async (req: Request, res: Response) => { $facet: { resultData: [ { - $sort: { price: 1, fullyBooked: 1, comingSoon: 1, _id: 1 }, + $sort: { fullyBooked: 1, comingSoon: 1, dailyPrice: 1, _id: 1 }, }, { $skip: (page - 1) * size }, { $limit: size },