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

pull/541/head
Bryann Yeap Kok Keong 2 years ago
parent 237b08442e
commit a395dcee34

@ -23,17 +23,16 @@ const seedAnalysis = async () => {
while (i < profilesWithoutAnalysis.length) {
const profile = profilesWithoutAnalysis[i];
await generateAnalysis({
ctx: { prisma, session: null },
input: { profileId: profile.id },
});
i++;
console.log(i, ': Analysis generated for profile with id', profile.id);
console.log(++i, ': Analysis generated for profile with id', profile.id);
}
console.log(i, ' analysis generated');
console.log(i, 'analysis generated');
};
Promise.all([seedAnalysis()])

@ -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: [

Loading…
Cancel
Save