diff --git a/apps/portal/prisma/seed-analysis.ts b/apps/portal/prisma/seed-analysis.ts index 74d96822..ab249a57 100644 --- a/apps/portal/prisma/seed-analysis.ts +++ b/apps/portal/prisma/seed-analysis.ts @@ -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()]) diff --git a/apps/portal/src/server/router/offers/offers.ts b/apps/portal/src/server/router/offers/offers.ts index ef425121..ff0d16af 100644 --- a/apps/portal/src/server/router/offers/offers.ts +++ b/apps/portal/src/server/router/offers/offers.ts @@ -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: [