Skip to content

Commit

Permalink
Fix: sorting logic in car retrieval functions
Browse files Browse the repository at this point in the history
  • Loading branch information
aelassas committed Jan 27, 2025
1 parent 1b1af42 commit 69555bf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/src/controllers/carController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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 },
Expand Down

0 comments on commit 69555bf

Please sign in to comment.