mirror of
https://github.com/yangshun/tech-interview-handbook.git
synced 2026-02-03 02:24:47 +08:00
[offers][feat] return base bonus stocks for dashboard
This commit is contained in:
committed by
Stuart Long Chay Boon
parent
b47cfceb09
commit
0c9dfd7658
@@ -700,6 +700,25 @@ export const dashboardOfferDtoMapper = (
|
||||
dashboardOfferDto.income = valuationDtoMapper(
|
||||
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) {
|
||||
dashboardOfferDto.income = valuationDtoMapper(
|
||||
offer.offersIntern.monthlySalary,
|
||||
@@ -712,10 +731,12 @@ export const dashboardOfferDtoMapper = (
|
||||
export const getOffersResponseMapper = (
|
||||
data: Array<DashboardOffer>,
|
||||
paging: Paging,
|
||||
jobType: JobType
|
||||
) => {
|
||||
const getOffersResponse: GetOffersResponse = {
|
||||
data,
|
||||
paging,
|
||||
jobType,
|
||||
paging
|
||||
};
|
||||
return getOffersResponse;
|
||||
};
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { z } from 'zod';
|
||||
import { JobType } from '@prisma/client';
|
||||
import { TRPCError } from '@trpc/server';
|
||||
|
||||
import {
|
||||
@@ -393,6 +394,7 @@ export const offersRouter = createRouter().query('list', {
|
||||
numOfPages: Math.ceil(data.length / input.limit),
|
||||
totalItems: data.length,
|
||||
},
|
||||
!yoeRange ? JobType.INTERN : JobType.FULLTIME
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
4
apps/portal/src/types/offers.d.ts
vendored
4
apps/portal/src/types/offers.d.ts
vendored
@@ -65,11 +65,14 @@ export type SpecificYoe = {
|
||||
};
|
||||
|
||||
export type DashboardOffer = {
|
||||
baseSalary?: Valuation;
|
||||
bonus?: Valuation;
|
||||
company: OffersCompany;
|
||||
id: string;
|
||||
income: Valuation;
|
||||
monthYearReceived: Date;
|
||||
profileId: string;
|
||||
stocks?: Valuation;
|
||||
title: string;
|
||||
totalYoe: number;
|
||||
};
|
||||
@@ -123,6 +126,7 @@ export type User = {
|
||||
|
||||
export type GetOffersResponse = {
|
||||
data: Array<DashboardOffer>;
|
||||
jobType: JobType;
|
||||
paging: Paging;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user