[offers][feat] return base bonus stocks for dashboard

pull/495/head
Stuart Long 2 years ago committed by Stuart Long Chay Boon
parent b47cfceb09
commit 0c9dfd7658

@ -700,6 +700,25 @@ export const dashboardOfferDtoMapper = (
dashboardOfferDto.income = valuationDtoMapper( dashboardOfferDto.income = valuationDtoMapper(
offer.offersFullTime.totalCompensation, offer.offersFullTime.totalCompensation,
); );
if (offer.offersFullTime.baseSalary) {
dashboardOfferDto.baseSalary = valuationDtoMapper(
offer.offersFullTime.baseSalary
);
}
if (offer.offersFullTime.bonus) {
dashboardOfferDto.bonus = valuationDtoMapper(
offer.offersFullTime.bonus
);
}
if (offer.offersFullTime.stocks) {
dashboardOfferDto.stocks = valuationDtoMapper(
offer.offersFullTime.stocks
);
}
} else if (offer.offersIntern) { } else if (offer.offersIntern) {
dashboardOfferDto.income = valuationDtoMapper( dashboardOfferDto.income = valuationDtoMapper(
offer.offersIntern.monthlySalary, offer.offersIntern.monthlySalary,
@ -712,10 +731,12 @@ export const dashboardOfferDtoMapper = (
export const getOffersResponseMapper = ( export const getOffersResponseMapper = (
data: Array<DashboardOffer>, data: Array<DashboardOffer>,
paging: Paging, paging: Paging,
jobType: JobType
) => { ) => {
const getOffersResponse: GetOffersResponse = { const getOffersResponse: GetOffersResponse = {
data, data,
paging, jobType,
paging
}; };
return getOffersResponse; return getOffersResponse;
}; };

@ -1,4 +1,5 @@
import { z } from 'zod'; import { z } from 'zod';
import { JobType } from '@prisma/client';
import { TRPCError } from '@trpc/server'; import { TRPCError } from '@trpc/server';
import { import {
@ -393,6 +394,7 @@ export const offersRouter = createRouter().query('list', {
numOfPages: Math.ceil(data.length / input.limit), numOfPages: Math.ceil(data.length / input.limit),
totalItems: data.length, totalItems: data.length,
}, },
!yoeRange ? JobType.INTERN : JobType.FULLTIME
); );
}, },
}); });

@ -65,11 +65,14 @@ export type SpecificYoe = {
}; };
export type DashboardOffer = { export type DashboardOffer = {
baseSalary?: Valuation;
bonus?: Valuation;
company: OffersCompany; company: OffersCompany;
id: string; id: string;
income: Valuation; income: Valuation;
monthYearReceived: Date; monthYearReceived: Date;
profileId: string; profileId: string;
stocks?: Valuation;
title: string; title: string;
totalYoe: number; totalYoe: number;
}; };
@ -123,6 +126,7 @@ export type User = {
export type GetOffersResponse = { export type GetOffersResponse = {
data: Array<DashboardOffer>; data: Array<DashboardOffer>;
jobType: JobType;
paging: Paging; paging: Paging;
}; };

Loading…
Cancel
Save