From 6db6c5f3c39203387c026137abdcf7fadfc5235d Mon Sep 17 00:00:00 2001 From: Bryann Yeap Kok Keong Date: Tue, 8 Nov 2022 22:51:48 +0800 Subject: [PATCH] [offers][chore] Add sorting dashboard offers by job title --- .../portal/src/server/router/offers/offers.ts | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/apps/portal/src/server/router/offers/offers.ts b/apps/portal/src/server/router/offers/offers.ts index ff0d16af..3f4fb790 100644 --- a/apps/portal/src/server/router/offers/offers.ts +++ b/apps/portal/src/server/router/offers/offers.ts @@ -18,6 +18,7 @@ const getOrder = (prefix: string) => { const sortingKeysMap = { companyName: 'companyName', + jobTitle: 'jobTitle', monthYearReceived: 'monthYearReceived', totalCompensation: 'totalCompensation', totalYoe: 'totalYoe', @@ -146,6 +147,20 @@ export const offersRouter = createRouter().query('list', { name: order, }, }, + { + monthYearReceived: 'desc', + }, + ] + : sortingKey === sortingKeysMap.jobTitle + ? [ + { + offersIntern: { + title: order, + }, + }, + { + monthYearReceived: 'desc', + }, ] : { monthYearReceived: 'desc' }, where: { @@ -284,6 +299,20 @@ export const offersRouter = createRouter().query('list', { name: order, }, }, + { + monthYearReceived: 'desc', + }, + ] + : sortingKey === sortingKeysMap.jobTitle + ? [ + { + offersFullTime: { + title: order, + }, + }, + { + monthYearReceived: 'desc', + }, ] : { monthYearReceived: 'desc' }, where: {