From 5e6482aa2e5b3c7aff8fa6b0b35bb74111007c9d Mon Sep 17 00:00:00 2001 From: Bryann Yeap Kok Keong Date: Sat, 22 Oct 2022 13:44:36 +0800 Subject: [PATCH] [offers][fix] Add previous companies to analysis DTO --- apps/portal/src/mappers/offers-mappers.ts | 35 +++++++++++++++++++---- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/apps/portal/src/mappers/offers-mappers.ts b/apps/portal/src/mappers/offers-mappers.ts index f8b0839f..4faee7ae 100644 --- a/apps/portal/src/mappers/offers-mappers.ts +++ b/apps/portal/src/mappers/offers-mappers.ts @@ -43,7 +43,13 @@ const analysisOfferDtoMapper = ( | (OffersFullTime & { totalCompensation: OffersCurrency }) | null; offersIntern: (OffersIntern & { monthlySalary: OffersCurrency }) | null; - profile: OffersProfile & { background: OffersBackground | null }; + profile: OffersProfile & { + background: + | (OffersBackground & { + experiences: Array; + }) + | null; + }; }, ) => { const { background, profileName } = offer.profile; @@ -56,7 +62,10 @@ const analysisOfferDtoMapper = ( location: offer.location, monthYearReceived: offer.monthYearReceived, negotiationStrategy: offer.negotiationStrategy, - previousCompanies: [], // TODO: Fill this up + previousCompanies: + background?.experiences + ?.filter((exp) => exp.company != null) + .map((exp) => exp.company?.name ?? '') ?? [], profileName, specialization: offer.jobType === JobType.FULLTIME @@ -103,10 +112,26 @@ const analysisDtoMapper = ( OffersOffer & { company: Company; offersFullTime: - | (OffersFullTime & { totalCompensation: OffersCurrency }) + | (OffersFullTime & { + totalCompensation: OffersCurrency; + }) | null; - offersIntern: (OffersIntern & { monthlySalary: OffersCurrency }) | null; - profile: OffersProfile & { background: OffersBackground | null }; + offersIntern: + | (OffersIntern & { + monthlySalary: OffersCurrency; + }) + | null; + profile: OffersProfile & { + background: + | (OffersBackground & { + experiences: Array< + OffersExperience & { + company: Company | null; + } + >; + }) + | null; + }; } >, ) => {