From 0db31eb0c148c29993fedc5ebd87716b939ccca0 Mon Sep 17 00:00:00 2001 From: Stuart Long Chay Boon Date: Wed, 26 Oct 2022 17:15:39 +0800 Subject: [PATCH 1/5] [offers][fix] fix create profile bug where experience not saved --- .../router/offers/offers-profile-router.ts | 131 +++++++++--------- 1 file changed, 66 insertions(+), 65 deletions(-) diff --git a/apps/portal/src/server/router/offers/offers-profile-router.ts b/apps/portal/src/server/router/offers/offers-profile-router.ts index f71d9c48..403ce32b 100644 --- a/apps/portal/src/server/router/offers/offers-profile-router.ts +++ b/apps/portal/src/server/router/offers/offers-profile-router.ts @@ -284,18 +284,42 @@ export const offersProfileRouter = createRouter() })), }, experiences: { - create: input.background.experiences.map(async (x) => { - if (x.jobType === JobType.FULLTIME) { - if (x.companyId) { - return { - company: { - connect: { - id: x.companyId, + create: await Promise.all( + input.background.experiences.map(async (x) => { + if (x.jobType === JobType.FULLTIME) { + if (x.companyId) { + return { + company: { + connect: { + id: x.companyId, + }, }, - }, + durationInMonths: x.durationInMonths, + jobType: x.jobType, + level: x.level, + title: x.title, + totalCompensation: + x.totalCompensation != null + ? { + create: { + baseCurrency: baseCurrencyString, + baseValue: await convert( + x.totalCompensation.value, + x.totalCompensation.currency, + baseCurrencyString, + ), + currency: x.totalCompensation.currency, + value: x.totalCompensation.value, + }, + } + : undefined, + }; + } + return { durationInMonths: x.durationInMonths, jobType: x.jobType, level: x.level, + location: x.location, title: x.title, totalCompensation: x.totalCompensation != null @@ -314,37 +338,35 @@ export const offersProfileRouter = createRouter() : undefined, }; } - return { - durationInMonths: x.durationInMonths, - jobType: x.jobType, - level: x.level, - location: x.location, - title: x.title, - totalCompensation: - x.totalCompensation != null - ? { - create: { - baseCurrency: baseCurrencyString, - baseValue: await convert( - x.totalCompensation.value, - x.totalCompensation.currency, - baseCurrencyString, - ), - currency: x.totalCompensation.currency, - value: x.totalCompensation.value, - }, - } - : undefined, - }; - } - if (x.jobType === JobType.INTERN) { - if (x.companyId) { - return { - company: { - connect: { - id: x.companyId, + if (x.jobType === JobType.INTERN) { + if (x.companyId) { + return { + company: { + connect: { + id: x.companyId, + }, }, - }, + durationInMonths: x.durationInMonths, + jobType: x.jobType, + monthlySalary: + x.monthlySalary != null + ? { + create: { + baseCurrency: baseCurrencyString, + baseValue: await convert( + x.monthlySalary.value, + x.monthlySalary.currency, + baseCurrencyString, + ), + currency: x.monthlySalary.currency, + value: x.monthlySalary.value, + }, + } + : undefined, + title: x.title, + }; + } + return { durationInMonths: x.durationInMonths, jobType: x.jobType, monthlySalary: @@ -365,33 +387,13 @@ export const offersProfileRouter = createRouter() title: x.title, }; } - return { - durationInMonths: x.durationInMonths, - jobType: x.jobType, - monthlySalary: - x.monthlySalary != null - ? { - create: { - baseCurrency: baseCurrencyString, - baseValue: await convert( - x.monthlySalary.value, - x.monthlySalary.currency, - baseCurrencyString, - ), - currency: x.monthlySalary.currency, - value: x.monthlySalary.value, - }, - } - : undefined, - title: x.title, - }; - } - throw new trpc.TRPCError({ - code: 'BAD_REQUEST', - message: 'Missing fields in background experiences.', - }); - }), + throw new trpc.TRPCError({ + code: 'BAD_REQUEST', + message: 'Missing fields in background experiences.', + }); + }), + ) }, specificYoes: { create: input.background.specificYoes.map((x) => { @@ -546,7 +548,6 @@ export const offersProfileRouter = createRouter() profileName: uniqueName, }, }); - return createOfferProfileResponseMapper(profile, token); }, }) From 2e13df0955b94d7632af575cf85ce74133979f67 Mon Sep 17 00:00:00 2001 From: Keane Chan Date: Wed, 26 Oct 2022 17:16:03 +0800 Subject: [PATCH 2/5] [resumes][feat] change to mostComments --- apps/portal/src/pages/resumes/browse.tsx | 2 +- apps/portal/src/utils/resumes/resumeFilters.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/portal/src/pages/resumes/browse.tsx b/apps/portal/src/pages/resumes/browse.tsx index f4ed682e..72c248a2 100644 --- a/apps/portal/src/pages/resumes/browse.tsx +++ b/apps/portal/src/pages/resumes/browse.tsx @@ -517,7 +517,7 @@ export default function ResumeHomePage() {
-
+
& Record>; -export type SortOrder = 'latest' | 'popular' | 'topComments'; +export type SortOrder = 'latest' | 'mostComments' | 'popular'; export type Shortcut = { customFilters?: CustomFilter; @@ -63,7 +63,7 @@ export const BROWSE_TABS_VALUES = { export const SORT_OPTIONS: Array> = [ { label: 'Latest', value: 'latest' }, { label: 'Popular', value: 'popular' }, - { label: 'Top Comments', value: 'topComments' }, + { label: 'Most Comments', value: 'mostComments' }, ]; export const ROLES: Array> = [ From e277cda7809effd3e94c434df45c8e3f2c34f4a9 Mon Sep 17 00:00:00 2001 From: Keane Chan Date: Wed, 26 Oct 2022 17:45:20 +0800 Subject: [PATCH 3/5] [resumes][feat] add app icon --- apps/portal/src/components/global/ProductNavigation.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/portal/src/components/global/ProductNavigation.tsx b/apps/portal/src/components/global/ProductNavigation.tsx index 5f162a51..d5ec2218 100644 --- a/apps/portal/src/components/global/ProductNavigation.tsx +++ b/apps/portal/src/components/global/ProductNavigation.tsx @@ -27,8 +27,11 @@ export default function ProductNavigation({ items, title, titleHref }: Props) { return (