mirror of
https://github.com/yangshun/tech-interview-handbook.git
synced 2025-08-01 06:33:52 +08:00
[offers][chore] Provide more information to frontend in AnalysisUnit
This commit is contained in:
@ -167,15 +167,51 @@ const analysisUnitDtoMapper = (
|
||||
>;
|
||||
},
|
||||
) => {
|
||||
const analysisDto: AnalysisUnit = {
|
||||
companyName: analysisUnit.analysedOffer.company.name,
|
||||
const { analysedOffer } = analysisUnit;
|
||||
const { jobType } = analysedOffer;
|
||||
|
||||
const analysisUnitDto: AnalysisUnit = {
|
||||
companyId: analysedOffer.companyId,
|
||||
companyName: analysedOffer.company.name,
|
||||
income: valuationDtoMapper({
|
||||
baseCurrency: '',
|
||||
baseValue: -1,
|
||||
currency: '',
|
||||
id: '',
|
||||
value: -1,
|
||||
}),
|
||||
jobType,
|
||||
noOfOffers: analysisUnit.noOfSimilarOffers,
|
||||
percentile: analysisUnit.percentile,
|
||||
title:
|
||||
jobType === JobType.FULLTIME && analysedOffer.offersFullTime != null
|
||||
? analysedOffer.offersFullTime.title
|
||||
: jobType === JobType.INTERN && analysedOffer.offersIntern != null
|
||||
? analysedOffer.offersIntern.title
|
||||
: '',
|
||||
topPercentileOffers: analysisUnit.topSimilarOffers.map((offer) =>
|
||||
analysisOfferDtoMapper(offer),
|
||||
),
|
||||
totalYoe: analysisUnit.analysedOffer.profile.background?.totalYoe ?? 0,
|
||||
};
|
||||
return analysisDto;
|
||||
|
||||
if (
|
||||
analysedOffer.offersFullTime &&
|
||||
analysedOffer.jobType === JobType.FULLTIME
|
||||
) {
|
||||
analysisUnitDto.income = valuationDtoMapper(
|
||||
analysedOffer.offersFullTime.totalCompensation,
|
||||
);
|
||||
} else if (
|
||||
analysedOffer.offersIntern &&
|
||||
analysedOffer.jobType === JobType.INTERN
|
||||
) {
|
||||
analysisUnitDto.income = valuationDtoMapper(
|
||||
analysedOffer.offersIntern.monthlySalary,
|
||||
);
|
||||
}
|
||||
|
||||
return analysisUnitDto;
|
||||
};
|
||||
|
||||
const analysisHighestOfferDtoMapper = (
|
||||
|
5
apps/portal/src/types/offers.d.ts
vendored
5
apps/portal/src/types/offers.d.ts
vendored
@ -157,10 +157,15 @@ export type ProfileAnalysis = {
|
||||
};
|
||||
|
||||
export type AnalysisUnit = {
|
||||
companyId: string;
|
||||
companyName: string;
|
||||
income: Valuation;
|
||||
jobType: JobType;
|
||||
noOfOffers: number;
|
||||
percentile: number;
|
||||
title: string;
|
||||
topPercentileOffers: Array<AnalysisOffer>;
|
||||
totalYoe: number;
|
||||
};
|
||||
|
||||
export type AnalysisHighestOffer = {
|
||||
|
Reference in New Issue
Block a user