From 13f40ab6ae89196f3695a986a1bad51b9bbb6e79 Mon Sep 17 00:00:00 2001
From: Bryann Yeap Kok Keong <bryannyeapkk@gmail.com>
Date: Sat, 22 Oct 2022 08:01:29 +0800
Subject: [PATCH] [offers][chore] Add baseCurrency and baseValue to Valuation
 DTO

---
 apps/portal/src/mappers/offers-mappers.ts           | 13 +++++++++++--
 apps/portal/src/pages/offers/test/createProfile.tsx |  8 ++++----
 apps/portal/src/pages/offers/test/listOffers.tsx    |  4 ++--
 apps/portal/src/types/offers.d.ts                   |  2 ++
 4 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/apps/portal/src/mappers/offers-mappers.ts b/apps/portal/src/mappers/offers-mappers.ts
index 1c1c9c33..ea0f624c 100644
--- a/apps/portal/src/mappers/offers-mappers.ts
+++ b/apps/portal/src/mappers/offers-mappers.ts
@@ -50,7 +50,7 @@ const analysisOfferDtoMapper = (
   const analysisOfferDto: AnalysisOffer = {
     company: offersCompanyDtoMapper(offer.company),
     id: offer.id,
-    income: { currency: '', value: -1 },
+    income: { baseCurrency: '', baseValue: -1, currency: '', value: -1 },
     jobType: offer.jobType,
     level: offer.offersFullTime?.level ?? '',
     location: offer.location,
@@ -219,11 +219,15 @@ export const profileAnalysisDtoMapper = (
 };
 
 export const valuationDtoMapper = (currency: {
+  baseCurrency: string;
+  baseValue: number;
   currency: string;
   id?: string;
   value: number;
 }) => {
   const valuationDto: Valuation = {
+    baseCurrency: currency.baseCurrency,
+    baseValue: currency.baseValue,
     currency: currency.currency,
     value: currency.value,
   };
@@ -554,7 +558,12 @@ export const dashboardOfferDtoMapper = (
   const dashboardOfferDto: DashboardOffer = {
     company: offersCompanyDtoMapper(offer.company),
     id: offer.id,
-    income: valuationDtoMapper({ currency: '', value: -1 }),
+    income: valuationDtoMapper({
+      baseCurrency: '',
+      baseValue: -1,
+      currency: '',
+      value: -1,
+    }),
     monthYearReceived: offer.monthYearReceived,
     profileId: offer.profileId,
     title: offer.offersFullTime?.title ?? '',
diff --git a/apps/portal/src/pages/offers/test/createProfile.tsx b/apps/portal/src/pages/offers/test/createProfile.tsx
index 7928ab12..972ba6ee 100644
--- a/apps/portal/src/pages/offers/test/createProfile.tsx
+++ b/apps/portal/src/pages/offers/test/createProfile.tsx
@@ -139,22 +139,22 @@ function Test() {
           offersFullTime: {
             baseSalary: {
               currency: 'SGD',
-              value: 84000,
+              value: 2222,
             },
             bonus: {
               currency: 'SGD',
-              value: 20000,
+              value: 2222,
             },
             level: 'Junior',
             specialization: 'Front End',
             stocks: {
               currency: 'SGD',
-              value: 100,
+              value: 0,
             },
             title: 'Software Engineer',
             totalCompensation: {
               currency: 'SGD',
-              value: 104100,
+              value: 4444,
             },
           },
         },
diff --git a/apps/portal/src/pages/offers/test/listOffers.tsx b/apps/portal/src/pages/offers/test/listOffers.tsx
index 911af3ac..747f5102 100644
--- a/apps/portal/src/pages/offers/test/listOffers.tsx
+++ b/apps/portal/src/pages/offers/test/listOffers.tsx
@@ -9,8 +9,8 @@ function Test() {
       limit: 100,
       location: 'Singapore, Singapore',
       offset: 0,
-      sortBy: '-monthYearReceived',
-      yoeCategory: 0,
+      sortBy: '-totalCompensation',
+      yoeCategory: 2,
     },
   ]);
 
diff --git a/apps/portal/src/types/offers.d.ts b/apps/portal/src/types/offers.d.ts
index 2605a30f..e2ca2d2f 100644
--- a/apps/portal/src/types/offers.d.ts
+++ b/apps/portal/src/types/offers.d.ts
@@ -42,6 +42,8 @@ export type OffersCompany = {
 };
 
 export type Valuation = {
+  baseCurrency: string;
+  baseValue: number;
   currency: string;
   value: number;
 };