From 80fd274662f24d624709ff0e307943cb2fc991f9 Mon Sep 17 00:00:00 2001 From: Bryann Yeap Kok Keong <77266823+BryannYeap@users.noreply.github.com> Date: Fri, 4 Nov 2022 12:32:50 +0800 Subject: [PATCH] [offers][chore] Add reference to analysed offer in analysis unit (#504) Co-authored-by: Bryann Yeap Kok Keong --- .../migration.sql | 16 + apps/portal/prisma/schema.prisma | 6 +- apps/portal/src/mappers/offers-mappers.ts | 57 +++- .../router/offers/offers-analysis-router.ts | 137 +------- .../router/offers/offers-profile-router.ts | 299 ++++++------------ .../{ => analysis}/analysisGeneration.ts | 147 +-------- .../offers/analysis/analysisInclusion.ts | 171 ++++++++++ 7 files changed, 345 insertions(+), 488 deletions(-) create mode 100644 apps/portal/prisma/migrations/20221104042559_add_reference_to_analysed_offer_in_analysis_unit/migration.sql rename apps/portal/src/utils/offers/{ => analysis}/analysisGeneration.ts (70%) create mode 100644 apps/portal/src/utils/offers/analysis/analysisInclusion.ts diff --git a/apps/portal/prisma/migrations/20221104042559_add_reference_to_analysed_offer_in_analysis_unit/migration.sql b/apps/portal/prisma/migrations/20221104042559_add_reference_to_analysed_offer_in_analysis_unit/migration.sql new file mode 100644 index 00000000..3a29e11f --- /dev/null +++ b/apps/portal/prisma/migrations/20221104042559_add_reference_to_analysed_offer_in_analysis_unit/migration.sql @@ -0,0 +1,16 @@ +/* + Warnings: + + - You are about to drop the column `companyId` on the `OffersAnalysisUnit` table. All the data in the column will be lost. + - Added the required column `analysedOfferId` to the `OffersAnalysisUnit` table without a default value. This is not possible if the table is not empty. + +*/ +-- DropForeignKey +ALTER TABLE "OffersAnalysisUnit" DROP CONSTRAINT "OffersAnalysisUnit_companyId_fkey"; + +-- AlterTable +ALTER TABLE "OffersAnalysisUnit" DROP COLUMN "companyId", +ADD COLUMN "analysedOfferId" TEXT NOT NULL; + +-- AddForeignKey +ALTER TABLE "OffersAnalysisUnit" ADD CONSTRAINT "OffersAnalysisUnit_analysedOfferId_fkey" FOREIGN KEY ("analysedOfferId") REFERENCES "OffersOffer"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/apps/portal/prisma/schema.prisma b/apps/portal/prisma/schema.prisma index e39941f2..cbf65808 100644 --- a/apps/portal/prisma/schema.prisma +++ b/apps/portal/prisma/schema.prisma @@ -104,7 +104,6 @@ model Company { questionsQuestionEncounter QuestionsQuestionEncounter[] OffersExperience OffersExperience[] OffersOffer OffersOffer[] - OffersAnalysisUnit OffersAnalysisUnit[] } model Country { @@ -368,6 +367,7 @@ model OffersOffer { offersAnalysis OffersAnalysis? @relation("HighestOverallOffer") offersAnalysisUnit OffersAnalysisUnit[] + OffersAnalysisUnit OffersAnalysisUnit[] @relation("Analysed Offer") } model OffersIntern { @@ -419,8 +419,8 @@ model OffersAnalysis { model OffersAnalysisUnit { id String @id @default(cuid()) - company Company @relation(fields: [companyId], references: [id]) - companyId String + analysedOffer OffersOffer @relation("Analysed Offer", fields: [analysedOfferId], references: [id]) + analysedOfferId String percentile Float noOfSimilarOffers Int diff --git a/apps/portal/src/mappers/offers-mappers.ts b/apps/portal/src/mappers/offers-mappers.ts index 17355490..b12eed1e 100644 --- a/apps/portal/src/mappers/offers-mappers.ts +++ b/apps/portal/src/mappers/offers-mappers.ts @@ -133,7 +133,14 @@ const analysisOfferDtoMapper = ( const analysisUnitDtoMapper = ( analysisUnit: OffersAnalysisUnit & { - company: Company; + analysedOffer: OffersOffer & { + company: Company; + offersFullTime: + | (OffersFullTime & { totalCompensation: OffersCurrency }) + | null; + offersIntern: (OffersIntern & { monthlySalary: OffersCurrency }) | null; + profile: OffersProfile & { background: OffersBackground | null }; + }; topSimilarOffers: Array< OffersOffer & { company: Company; @@ -161,7 +168,7 @@ const analysisUnitDtoMapper = ( }, ) => { const analysisDto: AnalysisUnit = { - companyName: analysisUnit.company.name, + companyName: analysisUnit.analysedOffer.company.name, noOfOffers: analysisUnit.noOfSimilarOffers, percentile: analysisUnit.percentile, topPercentileOffers: analysisUnit.topSimilarOffers.map((offer) => @@ -197,7 +204,16 @@ export const profileAnalysisDtoMapper = ( | (OffersAnalysis & { companyAnalysis: Array< OffersAnalysisUnit & { - company: Company; + analysedOffer: OffersOffer & { + company: Company; + offersFullTime: + | (OffersFullTime & { totalCompensation: OffersCurrency }) + | null; + offersIntern: + | (OffersIntern & { monthlySalary: OffersCurrency }) + | null; + profile: OffersProfile & { background: OffersBackground | null }; + }; topSimilarOffers: Array< OffersOffer & { company: Company; @@ -227,7 +243,16 @@ export const profileAnalysisDtoMapper = ( } >; overallAnalysis: OffersAnalysisUnit & { - company: Company; + analysedOffer: OffersOffer & { + company: Company; + offersFullTime: + | (OffersFullTime & { totalCompensation: OffersCurrency }) + | null; + offersIntern: + | (OffersIntern & { monthlySalary: OffersCurrency }) + | null; + profile: OffersProfile & { background: OffersBackground | null }; + }; topSimilarOffers: Array< OffersOffer & { company: Company; @@ -513,7 +538,18 @@ export const profileDtoMapper = ( | (OffersAnalysis & { companyAnalysis: Array< OffersAnalysisUnit & { - company: Company; + analysedOffer: OffersOffer & { + company: Company; + offersFullTime: + | (OffersFullTime & { totalCompensation: OffersCurrency }) + | null; + offersIntern: + | (OffersIntern & { monthlySalary: OffersCurrency }) + | null; + profile: OffersProfile & { + background: OffersBackground | null; + }; + }; topSimilarOffers: Array< OffersOffer & { company: Company; @@ -545,7 +581,16 @@ export const profileDtoMapper = ( } >; overallAnalysis: OffersAnalysisUnit & { - company: Company; + analysedOffer: OffersOffer & { + company: Company; + offersFullTime: + | (OffersFullTime & { totalCompensation: OffersCurrency }) + | null; + offersIntern: + | (OffersIntern & { monthlySalary: OffersCurrency }) + | null; + profile: OffersProfile & { background: OffersBackground | null }; + }; topSimilarOffers: Array< OffersOffer & { company: Company; diff --git a/apps/portal/src/server/router/offers/offers-analysis-router.ts b/apps/portal/src/server/router/offers/offers-analysis-router.ts index 5fdd9062..b1e0def8 100644 --- a/apps/portal/src/server/router/offers/offers-analysis-router.ts +++ b/apps/portal/src/server/router/offers/offers-analysis-router.ts @@ -2,9 +2,10 @@ import { z } from 'zod'; import { TRPCError } from '@trpc/server'; import { profileAnalysisDtoMapper } from '~/mappers/offers-mappers'; +import { analysisInclusion } from '~/utils/offers/analysis/analysisInclusion'; import { createRouter } from '../context'; -import { generateAnalysis } from '../../../utils/offers/analysisGeneration'; +import { generateAnalysis } from '../../../utils/offers/analysis/analysisGeneration'; export const offersAnalysisRouter = createRouter() .query('get', { @@ -13,139 +14,7 @@ export const offersAnalysisRouter = createRouter() }), async resolve({ ctx, input }) { const analysis = await ctx.prisma.offersAnalysis.findFirst({ - include: { - companyAnalysis: { - include: { - company: true, - topSimilarOffers: { - include: { - company: true, - location: { - include: { - state: { - include: { - country: true, - }, - }, - }, - }, - offersFullTime: { - include: { - totalCompensation: true, - }, - }, - offersIntern: { - include: { - monthlySalary: true, - }, - }, - profile: { - include: { - background: { - include: { - experiences: { - include: { - company: true, - location: { - include: { - state: { - include: { - country: true, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - overallAnalysis: { - include: { - company: true, - topSimilarOffers: { - include: { - company: true, - location: { - include: { - state: { - include: { - country: true, - }, - }, - }, - }, - offersFullTime: { - include: { - totalCompensation: true, - }, - }, - offersIntern: { - include: { - monthlySalary: true, - }, - }, - profile: { - include: { - background: { - include: { - experiences: { - include: { - company: true, - location: { - include: { - state: { - include: { - country: true, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - overallHighestOffer: { - include: { - company: true, - location: { - include: { - state: { - include: { - country: true, - }, - }, - }, - }, - offersFullTime: { - include: { - totalCompensation: true, - }, - }, - offersIntern: { - include: { - monthlySalary: true, - }, - }, - profile: { - include: { - background: true, - }, - }, - }, - }, - }, + include: analysisInclusion, where: { profileId: input.profileId, }, diff --git a/apps/portal/src/server/router/offers/offers-profile-router.ts b/apps/portal/src/server/router/offers/offers-profile-router.ts index cdf0c8b8..cd7cc386 100644 --- a/apps/portal/src/server/router/offers/offers-profile-router.ts +++ b/apps/portal/src/server/router/offers/offers-profile-router.ts @@ -8,6 +8,7 @@ import { createOfferProfileResponseMapper, profileDtoMapper, } from '~/mappers/offers-mappers'; +import { analysisInclusion } from '~/utils/offers/analysis/analysisInclusion'; import { baseCurrencyString } from '~/utils/offers/currency'; import { convert } from '~/utils/offers/currency/currencyExchange'; import { @@ -165,139 +166,7 @@ export const offersProfileRouter = createRouter() const result = await ctx.prisma.offersProfile.findFirst({ include: { analysis: { - include: { - companyAnalysis: { - include: { - company: true, - topSimilarOffers: { - include: { - company: true, - location: { - include: { - state: { - include: { - country: true, - }, - }, - }, - }, - offersFullTime: { - include: { - totalCompensation: true, - }, - }, - offersIntern: { - include: { - monthlySalary: true, - }, - }, - profile: { - include: { - background: { - include: { - experiences: { - include: { - company: true, - location: { - include: { - state: { - include: { - country: true, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - overallAnalysis: { - include: { - company: true, - topSimilarOffers: { - include: { - company: true, - location: { - include: { - state: { - include: { - country: true, - }, - }, - }, - }, - offersFullTime: { - include: { - totalCompensation: true, - }, - }, - offersIntern: { - include: { - monthlySalary: true, - }, - }, - profile: { - include: { - background: { - include: { - experiences: { - include: { - company: true, - location: { - include: { - state: { - include: { - country: true, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - overallHighestOffer: { - include: { - company: true, - location: { - include: { - state: { - include: { - country: true, - }, - }, - }, - }, - offersFullTime: { - include: { - totalCompensation: true, - }, - }, - offersIntern: { - include: { - monthlySalary: true, - }, - }, - profile: { - include: { - background: true, - }, - }, - }, - }, - }, + include: analysisInclusion, }, background: { include: { @@ -974,9 +843,9 @@ export const offersProfileRouter = createRouter() if (exp.id) { const currentExp = await ctx.prisma.offersExperience.findFirst({ where: { - id: exp.id - } - }) + id: exp.id, + }, + }); if (!currentExp) { throw new trpc.TRPCError({ @@ -1107,53 +976,53 @@ export const offersProfileRouter = createRouter() totalCompensationId: null, }, where: { - id: exp.id - } - }) + id: exp.id, + }, + }); } else if (exp.jobType === JobType.FULLTIME) { - if (exp.totalCompensation) { - await ctx.prisma.offersExperience.update({ - data: { - totalCompensation: { - upsert: { - create: { - baseCurrency: baseCurrencyString, - baseValue: await convert( - exp.totalCompensation.value, - exp.totalCompensation.currency, - baseCurrencyString, - ), - currency: exp.totalCompensation.currency, - value: exp.totalCompensation.value, - }, - update: { - baseCurrency: baseCurrencyString, - baseValue: await convert( - exp.totalCompensation.value, - exp.totalCompensation.currency, - baseCurrencyString, - ), - currency: exp.totalCompensation.currency, - value: exp.totalCompensation.value, - }, + if (exp.totalCompensation) { + await ctx.prisma.offersExperience.update({ + data: { + totalCompensation: { + upsert: { + create: { + baseCurrency: baseCurrencyString, + baseValue: await convert( + exp.totalCompensation.value, + exp.totalCompensation.currency, + baseCurrencyString, + ), + currency: exp.totalCompensation.currency, + value: exp.totalCompensation.value, + }, + update: { + baseCurrency: baseCurrencyString, + baseValue: await convert( + exp.totalCompensation.value, + exp.totalCompensation.currency, + baseCurrencyString, + ), + currency: exp.totalCompensation.currency, + value: exp.totalCompensation.value, }, }, }, - where: { - id: exp.id, - }, - }); - } - - await ctx.prisma.offersExperience.update({ - data: { - monthlySalary: undefined, - monthlySalaryId: null }, where: { - id: exp.id - } - }) + id: exp.id, + }, + }); + } + + await ctx.prisma.offersExperience.update({ + data: { + monthlySalary: undefined, + monthlySalaryId: null, + }, + where: { + id: exp.id, + }, + }); } } else if (!exp.id) { // Create new experience @@ -1686,9 +1555,9 @@ export const offersProfileRouter = createRouter() // Update existing offer const currentOffer = await ctx.prisma.offersOffer.findFirst({ where: { - id: offerToUpdate.id - } - }) + id: offerToUpdate.id, + }, + }); if (!currentOffer) { throw new trpc.TRPCError({ @@ -1753,7 +1622,8 @@ export const offersProfileRouter = createRouter() }, }, }, - startYear: offerToUpdate.offersIntern.startYear ?? undefined, + startYear: + offerToUpdate.offersIntern.startYear ?? undefined, title: offerToUpdate.offersIntern.title, }, where: { @@ -1786,7 +1656,8 @@ export const offersProfileRouter = createRouter() ), currency: offerToUpdate.offersFullTime.baseSalary.currency, - value: offerToUpdate.offersFullTime.baseSalary.value, + value: + offerToUpdate.offersFullTime.baseSalary.value, }, update: { baseCurrency: baseCurrencyString, @@ -1797,7 +1668,8 @@ export const offersProfileRouter = createRouter() ), currency: offerToUpdate.offersFullTime.baseSalary.currency, - value: offerToUpdate.offersFullTime.baseSalary.value, + value: + offerToUpdate.offersFullTime.baseSalary.value, }, }, }, @@ -1819,7 +1691,8 @@ export const offersProfileRouter = createRouter() offerToUpdate.offersFullTime.bonus.currency, baseCurrencyString, ), - currency: offerToUpdate.offersFullTime.bonus.currency, + currency: + offerToUpdate.offersFullTime.bonus.currency, value: offerToUpdate.offersFullTime.bonus.value, }, update: { @@ -1829,7 +1702,8 @@ export const offersProfileRouter = createRouter() offerToUpdate.offersFullTime.bonus.currency, baseCurrencyString, ), - currency: offerToUpdate.offersFullTime.bonus.currency, + currency: + offerToUpdate.offersFullTime.bonus.currency, value: offerToUpdate.offersFullTime.bonus.value, }, }, @@ -1882,7 +1756,8 @@ export const offersProfileRouter = createRouter() create: { baseCurrency: baseCurrencyString, baseValue: await convert( - offerToUpdate.offersFullTime.totalCompensation.value, + offerToUpdate.offersFullTime.totalCompensation + .value, offerToUpdate.offersFullTime.totalCompensation .currency, baseCurrencyString, @@ -1891,12 +1766,14 @@ export const offersProfileRouter = createRouter() offerToUpdate.offersFullTime.totalCompensation .currency, value: - offerToUpdate.offersFullTime.totalCompensation.value, + offerToUpdate.offersFullTime.totalCompensation + .value, }, update: { baseCurrency: baseCurrencyString, baseValue: await convert( - offerToUpdate.offersFullTime.totalCompensation.value, + offerToUpdate.offersFullTime.totalCompensation + .value, offerToUpdate.offersFullTime.totalCompensation .currency, baseCurrencyString, @@ -1905,7 +1782,8 @@ export const offersProfileRouter = createRouter() offerToUpdate.offersFullTime.totalCompensation .currency, value: - offerToUpdate.offersFullTime.totalCompensation.value, + offerToUpdate.offersFullTime.totalCompensation + .value, }, }, }, @@ -1940,7 +1818,8 @@ export const offersProfileRouter = createRouter() ), currency: offerToUpdate.offersFullTime.baseSalary.currency, - value: offerToUpdate.offersFullTime.baseSalary.value, + value: + offerToUpdate.offersFullTime.baseSalary.value, }, update: { baseCurrency: baseCurrencyString, @@ -1951,7 +1830,8 @@ export const offersProfileRouter = createRouter() ), currency: offerToUpdate.offersFullTime.baseSalary.currency, - value: offerToUpdate.offersFullTime.baseSalary.value, + value: + offerToUpdate.offersFullTime.baseSalary.value, }, }, }, @@ -1973,7 +1853,8 @@ export const offersProfileRouter = createRouter() offerToUpdate.offersFullTime.bonus.currency, baseCurrencyString, ), - currency: offerToUpdate.offersFullTime.bonus.currency, + currency: + offerToUpdate.offersFullTime.bonus.currency, value: offerToUpdate.offersFullTime.bonus.value, }, update: { @@ -1983,7 +1864,8 @@ export const offersProfileRouter = createRouter() offerToUpdate.offersFullTime.bonus.currency, baseCurrencyString, ), - currency: offerToUpdate.offersFullTime.bonus.currency, + currency: + offerToUpdate.offersFullTime.bonus.currency, value: offerToUpdate.offersFullTime.bonus.value, }, }, @@ -2036,7 +1918,8 @@ export const offersProfileRouter = createRouter() create: { baseCurrency: baseCurrencyString, baseValue: await convert( - offerToUpdate.offersFullTime.totalCompensation.value, + offerToUpdate.offersFullTime.totalCompensation + .value, offerToUpdate.offersFullTime.totalCompensation .currency, baseCurrencyString, @@ -2045,12 +1928,14 @@ export const offersProfileRouter = createRouter() offerToUpdate.offersFullTime.totalCompensation .currency, value: - offerToUpdate.offersFullTime.totalCompensation.value, + offerToUpdate.offersFullTime.totalCompensation + .value, }, update: { baseCurrency: baseCurrencyString, baseValue: await convert( - offerToUpdate.offersFullTime.totalCompensation.value, + offerToUpdate.offersFullTime.totalCompensation + .value, offerToUpdate.offersFullTime.totalCompensation .currency, baseCurrencyString, @@ -2059,7 +1944,8 @@ export const offersProfileRouter = createRouter() offerToUpdate.offersFullTime.totalCompensation .currency, value: - offerToUpdate.offersFullTime.totalCompensation.value, + offerToUpdate.offersFullTime.totalCompensation + .value, }, }, }, @@ -2073,12 +1959,12 @@ export const offersProfileRouter = createRouter() await ctx.prisma.offersOffer.update({ data: { offersIntern: undefined, - offersInternId: null + offersInternId: null, }, where: { - id: offerToUpdate.id - } - }) + id: offerToUpdate.id, + }, + }); } else if (currentOffer.jobType === JobType.INTERN) { if (offerToUpdate.offersIntern?.monthlySalary != null) { await ctx.prisma.offersIntern.update({ @@ -2111,7 +1997,8 @@ export const offersProfileRouter = createRouter() }, }, }, - startYear: offerToUpdate.offersIntern.startYear ?? undefined, + startYear: + offerToUpdate.offersIntern.startYear ?? undefined, title: offerToUpdate.offersIntern.title, }, where: { @@ -2123,12 +2010,12 @@ export const offersProfileRouter = createRouter() await ctx.prisma.offersOffer.update({ data: { offersFullTime: undefined, - offersFullTimeId: null + offersFullTimeId: null, }, where: { - id: offerToUpdate.id - } - }) + id: offerToUpdate.id, + }, + }); } } else { // Create new offer diff --git a/apps/portal/src/utils/offers/analysisGeneration.ts b/apps/portal/src/utils/offers/analysis/analysisGeneration.ts similarity index 70% rename from apps/portal/src/utils/offers/analysisGeneration.ts rename to apps/portal/src/utils/offers/analysis/analysisGeneration.ts index ad0fb428..484779ba 100644 --- a/apps/portal/src/utils/offers/analysisGeneration.ts +++ b/apps/portal/src/utils/offers/analysis/analysisGeneration.ts @@ -15,7 +15,8 @@ import type { } from '@prisma/client'; import { TRPCError } from '@trpc/server'; -import { profileAnalysisDtoMapper } from '../../mappers/offers-mappers'; +import { analysisInclusion } from './analysisInclusion'; +import { profileAnalysisDtoMapper } from '../../../mappers/offers-mappers'; type Offer = OffersOffer & { company: Company; @@ -292,7 +293,7 @@ export const generateAnalysis = async (params: { : similarCompanyOffers; return { - companyId: companyOffer.companyId, + analysedOfferId: companyOffer.id, noOfSimilarOffers: noOfSimilarCompanyOffers, percentile: companyPercentile, topSimilarOffers: topPercentileCompanyOffers, @@ -329,9 +330,9 @@ export const generateAnalysis = async (params: { companyAnalysis: { create: companyAnalysis.map((analysisUnit) => { return { - company: { + analysedOffer: { connect: { - id: analysisUnit.companyId, + id: analysisUnit.analysedOfferId, }, }, noOfSimilarOffers: analysisUnit.noOfSimilarOffers, @@ -346,9 +347,9 @@ export const generateAnalysis = async (params: { }, overallAnalysis: { create: { - company: { + analysedOffer: { connect: { - id: overallHighestOffer.companyId, + id: overallHighestOffer.id, }, }, noOfSimilarOffers, @@ -371,139 +372,7 @@ export const generateAnalysis = async (params: { }, }, }, - include: { - companyAnalysis: { - include: { - company: true, - topSimilarOffers: { - include: { - company: true, - location: { - include: { - state: { - include: { - country: true, - }, - }, - }, - }, - offersFullTime: { - include: { - totalCompensation: true, - }, - }, - offersIntern: { - include: { - monthlySalary: true, - }, - }, - profile: { - include: { - background: { - include: { - experiences: { - include: { - company: true, - location: { - include: { - state: { - include: { - country: true, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - overallAnalysis: { - include: { - company: true, - topSimilarOffers: { - include: { - company: true, - location: { - include: { - state: { - include: { - country: true, - }, - }, - }, - }, - offersFullTime: { - include: { - totalCompensation: true, - }, - }, - offersIntern: { - include: { - monthlySalary: true, - }, - }, - profile: { - include: { - background: { - include: { - experiences: { - include: { - company: true, - location: { - include: { - state: { - include: { - country: true, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - overallHighestOffer: { - include: { - company: true, - location: { - include: { - state: { - include: { - country: true, - }, - }, - }, - }, - offersFullTime: { - include: { - totalCompensation: true, - }, - }, - offersIntern: { - include: { - monthlySalary: true, - }, - }, - profile: { - include: { - background: true, - }, - }, - }, - }, - }, + include: analysisInclusion, }); return profileAnalysisDtoMapper(analysis); diff --git a/apps/portal/src/utils/offers/analysis/analysisInclusion.ts b/apps/portal/src/utils/offers/analysis/analysisInclusion.ts new file mode 100644 index 00000000..2c56ce8b --- /dev/null +++ b/apps/portal/src/utils/offers/analysis/analysisInclusion.ts @@ -0,0 +1,171 @@ +export const analysisInclusion = { + companyAnalysis: { + include: { + analysedOffer: { + include: { + company: true, + offersFullTime: { + include: { + totalCompensation: true, + }, + }, + offersIntern: { + include: { + monthlySalary: true, + }, + }, + profile: { + include: { + background: true, + }, + }, + }, + }, + topSimilarOffers: { + include: { + company: true, + location: { + include: { + state: { + include: { + country: true, + }, + }, + }, + }, + offersFullTime: { + include: { + totalCompensation: true, + }, + }, + offersIntern: { + include: { + monthlySalary: true, + }, + }, + profile: { + include: { + background: { + include: { + experiences: { + include: { + company: true, + location: { + include: { + state: { + include: { + country: true, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + overallAnalysis: { + include: { + analysedOffer: { + include: { + company: true, + offersFullTime: { + include: { + totalCompensation: true, + }, + }, + offersIntern: { + include: { + monthlySalary: true, + }, + }, + profile: { + include: { + background: true, + }, + }, + }, + }, + topSimilarOffers: { + include: { + company: true, + location: { + include: { + state: { + include: { + country: true, + }, + }, + }, + }, + offersFullTime: { + include: { + totalCompensation: true, + }, + }, + offersIntern: { + include: { + monthlySalary: true, + }, + }, + profile: { + include: { + background: { + include: { + experiences: { + include: { + company: true, + location: { + include: { + state: { + include: { + country: true, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + overallHighestOffer: { + include: { + company: true, + location: { + include: { + state: { + include: { + country: true, + }, + }, + }, + }, + offersFullTime: { + include: { + totalCompensation: true, + }, + }, + offersIntern: { + include: { + monthlySalary: true, + }, + }, + profile: { + include: { + background: true, + }, + }, + }, + }, +};