From bd9a30f1f8eae70f22444a1f912f3ec72f2a90d4 Mon Sep 17 00:00:00 2001 From: Bryann Yeap Kok Keong Date: Mon, 7 Nov 2022 13:49:29 +0800 Subject: [PATCH] [offers][chore] Add location field to dashboard offer --- apps/portal/src/mappers/offers-mappers.ts | 4 +++- .../portal/src/server/router/offers/offers.ts | 20 ++++++++++++++++++- apps/portal/src/types/offers.d.ts | 3 ++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/apps/portal/src/mappers/offers-mappers.ts b/apps/portal/src/mappers/offers-mappers.ts index 2e4c7ddc..8fa69461 100644 --- a/apps/portal/src/mappers/offers-mappers.ts +++ b/apps/portal/src/mappers/offers-mappers.ts @@ -763,6 +763,7 @@ export const addToProfileResponseMapper = (updatedProfile: { export const dashboardOfferDtoMapper = ( offer: OffersOffer & { company: Company; + location: City & { state: State & { country: Country } }; offersFullTime: | (OffersFullTime & { baseSalary: OffersCurrency | null; @@ -785,6 +786,7 @@ export const dashboardOfferDtoMapper = ( id: '', value: -1, }), + location: locationDtoMapper(offer.location), monthYearReceived: offer.monthYearReceived, profileId: offer.profileId, title: offer.offersFullTime?.title || offer.offersIntern?.title || '', @@ -934,4 +936,4 @@ const userProfileOfferDtoMapper = ( } return mappedOffer; -}; \ No newline at end of file +}; diff --git a/apps/portal/src/server/router/offers/offers.ts b/apps/portal/src/server/router/offers/offers.ts index b3b10d8a..d775950f 100644 --- a/apps/portal/src/server/router/offers/offers.ts +++ b/apps/portal/src/server/router/offers/offers.ts @@ -78,6 +78,15 @@ export const offersRouter = createRouter().query('list', { // Internship include: { company: true, + location: { + include: { + state: { + include: { + country: true, + }, + }, + }, + }, offersFullTime: { include: { baseSalary: true, @@ -198,6 +207,15 @@ export const offersRouter = createRouter().query('list', { // Junior, Mid, Senior include: { company: true, + location: { + include: { + state: { + include: { + country: true, + }, + }, + }, + }, offersFullTime: { include: { baseSalary: true, @@ -397,4 +415,4 @@ export const offersRouter = createRouter().query('list', { !yoeRange ? JobType.INTERN : JobType.FULLTIME, ); }, -}); \ No newline at end of file +}); diff --git a/apps/portal/src/types/offers.d.ts b/apps/portal/src/types/offers.d.ts index f00ad19e..e4f8892d 100644 --- a/apps/portal/src/types/offers.d.ts +++ b/apps/portal/src/types/offers.d.ts @@ -70,6 +70,7 @@ export type DashboardOffer = { company: OffersCompany; id: string; income: Valuation; + location: Location; monthYearReceived: Date; profileId: string; stocks?: Valuation; @@ -225,4 +226,4 @@ export type Location = { countryName: string; stateId: string; stateName: string; -}; \ No newline at end of file +};