diff --git a/next.config.js b/next.config.js index 92d219b0..a715d6bf 100644 --- a/next.config.js +++ b/next.config.js @@ -34,7 +34,7 @@ const nextConfig = { { protocol: 'https', hostname: 'www.example.com', - }, + } ], }, }; diff --git a/prisma/seed.ts b/prisma/seed.ts index 393709ad..27d6685a 100644 --- a/prisma/seed.ts +++ b/prisma/seed.ts @@ -393,4 +393,4 @@ async function main() { await seedJobs(); } -main(); +main(); \ No newline at end of file diff --git a/src/services/jobs.services.ts b/src/services/jobs.services.ts index c815cae5..8fc99945 100644 --- a/src/services/jobs.services.ts +++ b/src/services/jobs.services.ts @@ -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 = {