[offers][chore] Add sorting dashboard offers by company name

This commit is contained in:
Bryann Yeap Kok Keong
2022-11-08 22:47:06 +08:00
parent 237b08442e
commit a395dcee34
2 changed files with 20 additions and 4 deletions

View File

@@ -17,6 +17,7 @@ const getOrder = (prefix: string) => {
};
const sortingKeysMap = {
companyName: 'companyName',
monthYearReceived: 'monthYearReceived',
totalCompensation: 'totalCompensation',
totalYoe: 'totalYoe',
@@ -138,6 +139,14 @@ export const offersRouter = createRouter().query('list', {
monthYearReceived: 'desc',
},
]
: sortingKey === sortingKeysMap.companyName
? [
{
company: {
name: order,
},
},
]
: { monthYearReceived: 'desc' },
where: {
AND: [
@@ -268,6 +277,14 @@ export const offersRouter = createRouter().query('list', {
monthYearReceived: 'desc',
},
]
: sortingKey === sortingKeysMap.companyName
? [
{
company: {
name: order,
},
},
]
: { monthYearReceived: 'desc' },
where: {
AND: [