mirror of
https://github.com/yangshun/tech-interview-handbook.git
synced 2026-02-03 10:34:43 +08:00
[offers][chore] Add sorting dashboard offers by company name
This commit is contained in:
@@ -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: [
|
||||
|
||||
Reference in New Issue
Block a user