Skip to content

Commit

Permalink
Fix/523 non disclosed salary filtering (#528)
Browse files Browse the repository at this point in the history
* Checking bugs in pagination

* fix: #523 non-disclosed salary filtering

* corrected local changes
  • Loading branch information
SahilLamba0008 authored Oct 21, 2024
1 parent 05d6037 commit f2bff43
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const nextConfig = {
{
protocol: 'https',
hostname: 'www.example.com',
},
}
],
},
};
Expand Down
2 changes: 1 addition & 1 deletion prisma/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,4 +393,4 @@ async function main() {
await seedJobs();
}

main();
main();
7 changes: 6 additions & 1 deletion src/services/jobs.services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,18 @@ export function getJobFilters({
(filter) => filter !== undefined && filter !== null && filter !== ''
) as Prisma.JobWhereInput[],
};

const sortFieldMapping: { [key: string]: string } = {
postedat: 'postedAt',
maxsalary: 'maxSalary',
};

const [sort, sortOrder] = sortby.split('_');
const orderBy: Prisma.JobOrderByWithAggregationInput = sortby
? { [sortFieldMapping[sort]]: sortOrder }
? {
[sortFieldMapping[sort]]:
sort === 'maxsalary' ? { sort: sortOrder, nulls: 'last' } : sortOrder,
}
: {};

const pagination = {
Expand Down

0 comments on commit f2bff43

Please sign in to comment.