@ -35,12 +35,12 @@ const company = z.object({
} ) ;
} ) ;
const offer = z . object ( {
const offer = z . object ( {
cityId : z.string ( ) ,
comments : z.string ( ) ,
comments : z.string ( ) ,
company : company.nullish ( ) ,
company : company.nullish ( ) ,
companyId : z.string ( ) ,
companyId : z.string ( ) ,
id : z.string ( ) . optional ( ) ,
id : z.string ( ) . optional ( ) ,
jobType : z.string ( ) . regex ( createValidationRegex ( Object . keys ( JobType ) , null ) ) ,
jobType : z.string ( ) . regex ( createValidationRegex ( Object . keys ( JobType ) , null ) ) ,
location : z.string ( ) ,
monthYearReceived : z.date ( ) ,
monthYearReceived : z.date ( ) ,
negotiationStrategy : z.string ( ) ,
negotiationStrategy : z.string ( ) ,
offersFullTime : z
offersFullTime : z
@ -75,6 +75,7 @@ const offer = z.object({
const experience = z . object ( {
const experience = z . object ( {
backgroundId : z.string ( ) . nullish ( ) ,
backgroundId : z.string ( ) . nullish ( ) ,
cityId : z.string ( ) . nullish ( ) ,
company : company.nullish ( ) ,
company : company.nullish ( ) ,
companyId : z.string ( ) . nullish ( ) ,
companyId : z.string ( ) . nullish ( ) ,
durationInMonths : z.number ( ) . nullish ( ) ,
durationInMonths : z.number ( ) . nullish ( ) ,
@ -84,7 +85,6 @@ const experience = z.object({
. regex ( createValidationRegex ( Object . keys ( JobType ) , null ) )
. regex ( createValidationRegex ( Object . keys ( JobType ) , null ) )
. nullish ( ) ,
. nullish ( ) ,
level : z.string ( ) . nullish ( ) ,
level : z.string ( ) . nullish ( ) ,
location : z.string ( ) . nullish ( ) ,
monthlySalary : valuation.nullish ( ) ,
monthlySalary : valuation.nullish ( ) ,
monthlySalaryId : z.string ( ) . nullish ( ) ,
monthlySalaryId : z.string ( ) . nullish ( ) ,
title : z.string ( ) . nullish ( ) ,
title : z.string ( ) . nullish ( ) ,
@ -171,6 +171,15 @@ export const offersProfileRouter = createRouter()
topSimilarOffers : {
topSimilarOffers : {
include : {
include : {
company : true ,
company : true ,
location : {
include : {
state : {
include : {
country : true ,
} ,
} ,
} ,
} ,
offersFullTime : {
offersFullTime : {
include : {
include : {
totalCompensation : true ,
totalCompensation : true ,
@ -188,6 +197,15 @@ export const offersProfileRouter = createRouter()
experiences : {
experiences : {
include : {
include : {
company : true ,
company : true ,
location : {
include : {
state : {
include : {
country : true ,
} ,
} ,
} ,
} ,
} ,
} ,
} ,
} ,
} ,
} ,
@ -203,6 +221,15 @@ export const offersProfileRouter = createRouter()
topSimilarOffers : {
topSimilarOffers : {
include : {
include : {
company : true ,
company : true ,
location : {
include : {
state : {
include : {
country : true ,
} ,
} ,
} ,
} ,
offersFullTime : {
offersFullTime : {
include : {
include : {
totalCompensation : true ,
totalCompensation : true ,
@ -220,6 +247,15 @@ export const offersProfileRouter = createRouter()
experiences : {
experiences : {
include : {
include : {
company : true ,
company : true ,
location : {
include : {
state : {
include : {
country : true ,
} ,
} ,
} ,
} ,
} ,
} ,
} ,
} ,
} ,
} ,
@ -233,6 +269,15 @@ export const offersProfileRouter = createRouter()
overallHighestOffer : {
overallHighestOffer : {
include : {
include : {
company : true ,
company : true ,
location : {
include : {
state : {
include : {
country : true ,
} ,
} ,
} ,
} ,
offersFullTime : {
offersFullTime : {
include : {
include : {
totalCompensation : true ,
totalCompensation : true ,
@ -258,6 +303,15 @@ export const offersProfileRouter = createRouter()
experiences : {
experiences : {
include : {
include : {
company : true ,
company : true ,
location : {
include : {
state : {
include : {
country : true ,
} ,
} ,
} ,
} ,
monthlySalary : true ,
monthlySalary : true ,
totalCompensation : true ,
totalCompensation : true ,
} ,
} ,
@ -275,6 +329,15 @@ export const offersProfileRouter = createRouter()
offers : {
offers : {
include : {
include : {
company : true ,
company : true ,
location : {
include : {
state : {
include : {
country : true ,
} ,
} ,
} ,
} ,
offersFullTime : {
offersFullTime : {
include : {
include : {
baseSalary : true ,
baseSalary : true ,
@ -350,6 +413,39 @@ export const offersProfileRouter = createRouter()
input . background . experiences . map ( async ( x ) = > {
input . background . experiences . map ( async ( x ) = > {
if ( x . jobType === JobType . FULLTIME ) {
if ( x . jobType === JobType . FULLTIME ) {
if ( x . companyId ) {
if ( x . companyId ) {
if ( x . cityId ) {
return {
company : {
connect : {
id : x.companyId ,
} ,
} ,
durationInMonths : x.durationInMonths ,
jobType : x.jobType ,
level : x.level ,
location : {
connect : {
id : x.cityId
}
} ,
title : x.title ,
totalCompensation :
x . totalCompensation != null
? {
create : {
baseCurrency : baseCurrencyString ,
baseValue : await convert (
x . totalCompensation . value ,
x . totalCompensation . currency ,
baseCurrencyString ,
) ,
currency : x.totalCompensation.currency ,
value : x.totalCompensation.value ,
} ,
}
: undefined ,
} ;
}
return {
return {
company : {
company : {
connect : {
connect : {
@ -377,11 +473,40 @@ export const offersProfileRouter = createRouter()
: undefined ,
: undefined ,
} ;
} ;
}
}
if ( x . cityId ) {
return {
durationInMonths : x.durationInMonths ,
jobType : x.jobType ,
level : x.level ,
location : {
connect : {
where : {
id : x.cityId
}
}
} ,
title : x.title ,
totalCompensation :
x . totalCompensation != null
? {
create : {
baseCurrency : baseCurrencyString ,
baseValue : await convert (
x . totalCompensation . value ,
x . totalCompensation . currency ,
baseCurrencyString ,
) ,
currency : x.totalCompensation.currency ,
value : x.totalCompensation.value ,
} ,
}
: undefined ,
} ;
}
return {
return {
durationInMonths : x.durationInMonths ,
durationInMonths : x.durationInMonths ,
jobType : x.jobType ,
jobType : x.jobType ,
level : x.level ,
level : x.level ,
location : x.location ,
title : x.title ,
title : x.title ,
totalCompensation :
totalCompensation :
x . totalCompensation != null
x . totalCompensation != null
@ -402,6 +527,40 @@ export const offersProfileRouter = createRouter()
}
}
if ( x . jobType === JobType . INTERN ) {
if ( x . jobType === JobType . INTERN ) {
if ( x . companyId ) {
if ( x . companyId ) {
if ( x . cityId ) {
return {
company : {
connect : {
id : x.companyId ,
} ,
} ,
durationInMonths : x.durationInMonths ,
jobType : x.jobType ,
location : {
connect : {
where : {
id : x.cityId
}
}
} ,
monthlySalary :
x . monthlySalary != null
? {
create : {
baseCurrency : baseCurrencyString ,
baseValue : await convert (
x . monthlySalary . value ,
x . monthlySalary . currency ,
baseCurrencyString ,
) ,
currency : x.monthlySalary.currency ,
value : x.monthlySalary.value ,
} ,
}
: undefined ,
title : x.title ,
} ;
}
return {
return {
company : {
company : {
connect : {
connect : {
@ -428,6 +587,37 @@ export const offersProfileRouter = createRouter()
title : x.title ,
title : x.title ,
} ;
} ;
}
}
if ( x . cityId ) {
return {
durationInMonths : x.durationInMonths ,
jobType : x.jobType ,
location : {
connect : {
where : {
id : x.cityId
}
}
} ,
monthlySalary :
x . monthlySalary != null
? {
create : {
baseCurrency : baseCurrencyString ,
baseValue : await convert (
x . monthlySalary . value ,
x . monthlySalary . currency ,
baseCurrencyString ,
) ,
currency : x.monthlySalary.currency ,
value : x.monthlySalary.value ,
} ,
}
: undefined ,
title : x.title ,
} ;
}
return {
return {
durationInMonths : x.durationInMonths ,
durationInMonths : x.durationInMonths ,
jobType : x.jobType ,
jobType : x.jobType ,
@ -488,7 +678,13 @@ export const offersProfileRouter = createRouter()
} ,
} ,
} ,
} ,
jobType : x.jobType ,
jobType : x.jobType ,
location : x.location ,
location : {
connect : {
where : {
id : x.cityId
}
}
} ,
monthYearReceived : x.monthYearReceived ,
monthYearReceived : x.monthYearReceived ,
negotiationStrategy : x.negotiationStrategy ,
negotiationStrategy : x.negotiationStrategy ,
offersIntern : {
offersIntern : {
@ -528,7 +724,13 @@ export const offersProfileRouter = createRouter()
} ,
} ,
} ,
} ,
jobType : x.jobType ,
jobType : x.jobType ,
location : x.location ,
location : {
connect : {
where : {
id : x.cityId
}
}
} ,
monthYearReceived : x.monthYearReceived ,
monthYearReceived : x.monthYearReceived ,
negotiationStrategy : x.negotiationStrategy ,
negotiationStrategy : x.negotiationStrategy ,
offersFullTime : {
offersFullTime : {
@ -809,14 +1011,14 @@ export const offersProfileRouter = createRouter()
) ,
) ,
currency : exp.monthlySalary.currency ,
currency : exp.monthlySalary.currency ,
value : exp.monthlySalary.value ,
value : exp.monthlySalary.value ,
}
} ,
}
} ,
}
} ,
} ,
} ,
where : {
where : {
id : exp.id
id : exp.id ,
}
} ,
} )
} ) ;
}
}
if ( exp . totalCompensation ) {
if ( exp . totalCompensation ) {
@ -843,14 +1045,14 @@ export const offersProfileRouter = createRouter()
) ,
) ,
currency : exp.totalCompensation.currency ,
currency : exp.totalCompensation.currency ,
value : exp.totalCompensation.value ,
value : exp.totalCompensation.value ,
}
} ,
}
} ,
}
} ,
} ,
} ,
where : {
where : {
id : exp.id
id : exp.id ,
}
} ,
} )
} ) ;
}
}
} else if ( ! exp . id ) {
} else if ( ! exp . id ) {
// Create new experience
// Create new experience
@ -859,35 +1061,110 @@ export const offersProfileRouter = createRouter()
exp . totalCompensation ? . currency != null &&
exp . totalCompensation ? . currency != null &&
exp . totalCompensation ? . value != null
exp . totalCompensation ? . value != null
) {
) {
// FULLTIME
if ( exp . companyId ) {
if ( exp . companyId ) {
if ( exp . cityId ) {
await ctx . prisma . offersBackground . update ( {
data : {
experiences : {
create : {
company : {
connect : {
id : exp.companyId ,
} ,
} ,
durationInMonths : exp.durationInMonths ,
jobType : exp.jobType ,
level : exp.level ,
location : {
connect : {
id : exp.cityId
}
} ,
title : exp.title ,
totalCompensation : exp.totalCompensation
? {
create : {
baseCurrency : baseCurrencyString ,
baseValue : await convert (
exp . totalCompensation . value ,
exp . totalCompensation . currency ,
baseCurrencyString ,
) ,
currency : exp.totalCompensation.currency ,
value : exp.totalCompensation.value ,
} ,
}
: undefined ,
} ,
} ,
} ,
where : {
id : input.background.id ,
} ,
} ) ;
} else {
await ctx . prisma . offersBackground . update ( {
data : {
experiences : {
create : {
company : {
connect : {
id : exp.companyId ,
} ,
} ,
durationInMonths : exp.durationInMonths ,
jobType : exp.jobType ,
level : exp.level ,
title : exp.title ,
totalCompensation : exp.totalCompensation
? {
create : {
baseCurrency : baseCurrencyString ,
baseValue : await convert (
exp . totalCompensation . value ,
exp . totalCompensation . currency ,
baseCurrencyString ,
) ,
currency : exp.totalCompensation.currency ,
value : exp.totalCompensation.value ,
} ,
}
: undefined ,
} ,
} ,
} ,
where : {
id : input.background.id ,
} ,
} ) ;
}
} else if ( exp . cityId ) {
await ctx . prisma . offersBackground . update ( {
await ctx . prisma . offersBackground . update ( {
data : {
data : {
experiences : {
experiences : {
create : {
create : {
company : {
connect : {
id : exp.companyId ,
} ,
} ,
durationInMonths : exp.durationInMonths ,
durationInMonths : exp.durationInMonths ,
jobType : exp.jobType ,
jobType : exp.jobType ,
level : exp.level ,
level : exp.level ,
location : exp.location ,
location : {
connect : {
id : exp.cityId
}
} ,
title : exp.title ,
title : exp.title ,
totalCompensation : exp.totalCompensation
totalCompensation : {
? {
create : {
create : {
baseCurrency : baseCurrencyString ,
baseCurrency : baseCurrencyString ,
baseValue : await convert (
baseValue : await convert (
exp . totalCompensation . value ,
exp . totalCompensation . value ,
exp . totalCompensation . currency ,
exp . totalCompensation . currency ,
baseCurrencyString ,
baseCurrencyString ,
) ,
) ,
currency : exp.totalCompensation.currency ,
currency : exp.totalCompensation.currency ,
value : exp.totalCompensation.value ,
value : exp.totalCompensation.value ,
} ,
} ,
} ,
}
: undefined ,
} ,
} ,
} ,
} ,
} ,
} ,
@ -903,7 +1180,6 @@ export const offersProfileRouter = createRouter()
durationInMonths : exp.durationInMonths ,
durationInMonths : exp.durationInMonths ,
jobType : exp.jobType ,
jobType : exp.jobType ,
level : exp.level ,
level : exp.level ,
location : exp.location ,
title : exp.title ,
title : exp.title ,
totalCompensation : {
totalCompensation : {
create : {
create : {
@ -926,19 +1202,67 @@ export const offersProfileRouter = createRouter()
} ) ;
} ) ;
}
}
} else if ( exp . companyId ) {
} else if ( exp . companyId ) {
if ( exp . cityId ) {
await ctx . prisma . offersBackground . update ( {
data : {
experiences : {
create : {
company : {
connect : {
id : exp.companyId ,
} ,
} ,
durationInMonths : exp.durationInMonths ,
jobType : exp.jobType ,
level : exp.level ,
location : {
connect : {
id : exp.cityId
}
} ,
title : exp.title ,
} ,
} ,
} ,
where : {
id : input.background.id ,
} ,
} ) ;
} else {
await ctx . prisma . offersBackground . update ( {
data : {
experiences : {
create : {
company : {
connect : {
id : exp.companyId ,
} ,
} ,
durationInMonths : exp.durationInMonths ,
jobType : exp.jobType ,
level : exp.level ,
title : exp.title ,
} ,
} ,
} ,
where : {
id : input.background.id ,
} ,
} ) ;
}
} else if ( exp . cityId ) {
await ctx . prisma . offersBackground . update ( {
await ctx . prisma . offersBackground . update ( {
data : {
data : {
experiences : {
experiences : {
create : {
create : {
company : {
connect : {
id : exp.companyId ,
} ,
} ,
durationInMonths : exp.durationInMonths ,
durationInMonths : exp.durationInMonths ,
jobType : exp.jobType ,
jobType : exp.jobType ,
level : exp.level ,
level : exp.level ,
location : exp.location ,
location : {
connect : {
id : exp.cityId
}
} ,
title : exp.title ,
title : exp.title ,
} ,
} ,
} ,
} ,
@ -955,7 +1279,6 @@ export const offersProfileRouter = createRouter()
durationInMonths : exp.durationInMonths ,
durationInMonths : exp.durationInMonths ,
jobType : exp.jobType ,
jobType : exp.jobType ,
level : exp.level ,
level : exp.level ,
location : exp.location ,
title : exp.title ,
title : exp.title ,
} ,
} ,
} ,
} ,
@ -970,19 +1293,90 @@ export const offersProfileRouter = createRouter()
exp . monthlySalary ? . currency != null &&
exp . monthlySalary ? . currency != null &&
exp . monthlySalary ? . value != null
exp . monthlySalary ? . value != null
) {
) {
// INTERN
if ( exp . companyId ) {
if ( exp . companyId ) {
if ( exp . cityId ) {
await ctx . prisma . offersBackground . update ( {
data : {
experiences : {
create : {
company : {
connect : {
id : exp.companyId ,
} ,
} ,
durationInMonths : exp.durationInMonths ,
jobType : exp.jobType ,
location : {
connect : {
id : exp.cityId
}
} ,
monthlySalary : {
create : {
baseCurrency : baseCurrencyString ,
baseValue : await convert (
exp . monthlySalary . value ,
exp . monthlySalary . currency ,
baseCurrencyString ,
) ,
currency : exp.monthlySalary.currency ,
value : exp.monthlySalary.value ,
} ,
} ,
title : exp.title ,
} ,
} ,
} ,
where : {
id : input.background.id ,
} ,
} ) ;
} else {
await ctx . prisma . offersBackground . update ( {
data : {
experiences : {
create : {
company : {
connect : {
id : exp.companyId ,
} ,
} ,
durationInMonths : exp.durationInMonths ,
jobType : exp.jobType ,
monthlySalary : {
create : {
baseCurrency : baseCurrencyString ,
baseValue : await convert (
exp . monthlySalary . value ,
exp . monthlySalary . currency ,
baseCurrencyString ,
) ,
currency : exp.monthlySalary.currency ,
value : exp.monthlySalary.value ,
} ,
} ,
title : exp.title ,
} ,
} ,
} ,
where : {
id : input.background.id ,
} ,
} ) ;
}
} else if ( exp . cityId ) {
await ctx . prisma . offersBackground . update ( {
await ctx . prisma . offersBackground . update ( {
data : {
data : {
experiences : {
experiences : {
create : {
create : {
company : {
connect : {
id : exp.companyId ,
} ,
} ,
durationInMonths : exp.durationInMonths ,
durationInMonths : exp.durationInMonths ,
jobType : exp.jobType ,
jobType : exp.jobType ,
location : exp.location ,
location : {
connect : {
id : exp.cityId
}
} ,
monthlySalary : {
monthlySalary : {
create : {
create : {
baseCurrency : baseCurrencyString ,
baseCurrency : baseCurrencyString ,
@ -1010,7 +1404,6 @@ export const offersProfileRouter = createRouter()
create : {
create : {
durationInMonths : exp.durationInMonths ,
durationInMonths : exp.durationInMonths ,
jobType : exp.jobType ,
jobType : exp.jobType ,
location : exp.location ,
monthlySalary : {
monthlySalary : {
create : {
create : {
baseCurrency : baseCurrencyString ,
baseCurrency : baseCurrencyString ,
@ -1033,18 +1426,64 @@ export const offersProfileRouter = createRouter()
} ) ;
} ) ;
}
}
} else if ( exp . companyId ) {
} else if ( exp . companyId ) {
if ( exp . cityId ) {
await ctx . prisma . offersBackground . update ( {
data : {
experiences : {
create : {
company : {
connect : {
id : exp.companyId ,
} ,
} ,
durationInMonths : exp.durationInMonths ,
jobType : exp.jobType ,
location : {
connect : {
id : exp.cityId ,
}
} ,
title : exp.title ,
} ,
} ,
} ,
where : {
id : input.background.id ,
} ,
} ) ;
} else {
await ctx . prisma . offersBackground . update ( {
data : {
experiences : {
create : {
company : {
connect : {
id : exp.companyId ,
} ,
} ,
durationInMonths : exp.durationInMonths ,
jobType : exp.jobType ,
title : exp.title ,
} ,
} ,
} ,
where : {
id : input.background.id ,
} ,
} ) ;
}
} else if ( exp . cityId ) {
await ctx . prisma . offersBackground . update ( {
await ctx . prisma . offersBackground . update ( {
data : {
data : {
experiences : {
experiences : {
create : {
create : {
company : {
connect : {
id : exp.companyId ,
} ,
} ,
durationInMonths : exp.durationInMonths ,
durationInMonths : exp.durationInMonths ,
jobType : exp.jobType ,
jobType : exp.jobType ,
location : exp.location ,
location : {
connect : {
id : exp.cityId
}
} ,
title : exp.title ,
title : exp.title ,
} ,
} ,
} ,
} ,
@ -1060,7 +1499,6 @@ export const offersProfileRouter = createRouter()
create : {
create : {
durationInMonths : exp.durationInMonths ,
durationInMonths : exp.durationInMonths ,
jobType : exp.jobType ,
jobType : exp.jobType ,
location : exp.location ,
title : exp.title ,
title : exp.title ,
} ,
} ,
} ,
} ,
@ -1148,12 +1586,20 @@ export const offersProfileRouter = createRouter()
await ctx . prisma . offersOffer . update ( {
await ctx . prisma . offersOffer . update ( {
data : {
data : {
comments : offerToUpdate.comments ,
comments : offerToUpdate.comments ,
companyId : offerToUpdate.companyId ,
company : {
connect : {
id : offerToUpdate.companyId
}
} ,
jobType :
jobType :
offerToUpdate . jobType === JobType . FULLTIME
offerToUpdate . jobType === JobType . FULLTIME
? JobType . FULLTIME
? JobType . FULLTIME
: JobType . INTERN ,
: JobType . INTERN ,
location : offerToUpdate.location ,
location : {
connect : {
id : offerToUpdate.cityId
}
} ,
monthYearReceived : offerToUpdate.monthYearReceived ,
monthYearReceived : offerToUpdate.monthYearReceived ,
negotiationStrategy : offerToUpdate.negotiationStrategy ,
negotiationStrategy : offerToUpdate.negotiationStrategy ,
} ,
} ,
@ -1176,7 +1622,8 @@ export const offersProfileRouter = createRouter()
offerToUpdate . offersIntern . monthlySalary . currency ,
offerToUpdate . offersIntern . monthlySalary . currency ,
baseCurrencyString ,
baseCurrencyString ,
) ,
) ,
currency : offerToUpdate.offersIntern.monthlySalary.currency ,
currency :
offerToUpdate . offersIntern . monthlySalary . currency ,
value : offerToUpdate.offersIntern.monthlySalary.value ,
value : offerToUpdate.offersIntern.monthlySalary.value ,
} ,
} ,
update : {
update : {
@ -1186,13 +1633,14 @@ export const offersProfileRouter = createRouter()
offerToUpdate . offersIntern . monthlySalary . currency ,
offerToUpdate . offersIntern . monthlySalary . currency ,
baseCurrencyString ,
baseCurrencyString ,
) ,
) ,
currency : offerToUpdate.offersIntern.monthlySalary.currency ,
currency :
offerToUpdate . offersIntern . monthlySalary . currency ,
value : offerToUpdate.offersIntern.monthlySalary.value ,
value : offerToUpdate.offersIntern.monthlySalary.value ,
}
} ,
}
} ,
} ,
} ,
startYear : offerToUpdate.offersIntern.startYear ? ? undefined ,
startYear : offerToUpdate.offersIntern.startYear ? ? undefined ,
title : offerToUpdate.offersIntern.title
title : offerToUpdate.offersIntern.title ,
} ,
} ,
where : {
where : {
id : offerToUpdate.offersIntern.id ,
id : offerToUpdate.offersIntern.id ,
@ -1222,7 +1670,8 @@ export const offersProfileRouter = createRouter()
offerToUpdate . offersFullTime . baseSalary . currency ,
offerToUpdate . offersFullTime . baseSalary . currency ,
baseCurrencyString ,
baseCurrencyString ,
) ,
) ,
currency : offerToUpdate.offersFullTime.baseSalary.currency ,
currency :
offerToUpdate . offersFullTime . baseSalary . currency ,
value : offerToUpdate.offersFullTime.baseSalary.value ,
value : offerToUpdate.offersFullTime.baseSalary.value ,
} ,
} ,
update : {
update : {
@ -1232,11 +1681,12 @@ export const offersProfileRouter = createRouter()
offerToUpdate . offersFullTime . baseSalary . currency ,
offerToUpdate . offersFullTime . baseSalary . currency ,
baseCurrencyString ,
baseCurrencyString ,
) ,
) ,
currency : offerToUpdate.offersFullTime.baseSalary.currency ,
currency :
offerToUpdate . offersFullTime . baseSalary . currency ,
value : offerToUpdate.offersFullTime.baseSalary.value ,
value : offerToUpdate.offersFullTime.baseSalary.value ,
}
} ,
}
} ,
}
} ,
} ,
} ,
where : {
where : {
id : offerToUpdate.offersFullTime.id ,
id : offerToUpdate.offersFullTime.id ,
@ -1267,9 +1717,9 @@ export const offersProfileRouter = createRouter()
) ,
) ,
currency : offerToUpdate.offersFullTime.bonus.currency ,
currency : offerToUpdate.offersFullTime.bonus.currency ,
value : offerToUpdate.offersFullTime.bonus.value ,
value : offerToUpdate.offersFullTime.bonus.value ,
}
} ,
}
} ,
}
} ,
} ,
} ,
where : {
where : {
id : offerToUpdate.offersFullTime.id ,
id : offerToUpdate.offersFullTime.id ,
@ -1288,7 +1738,8 @@ export const offersProfileRouter = createRouter()
offerToUpdate . offersFullTime . stocks . currency ,
offerToUpdate . offersFullTime . stocks . currency ,
baseCurrencyString ,
baseCurrencyString ,
) ,
) ,
currency : offerToUpdate.offersFullTime.stocks.currency ,
currency :
offerToUpdate . offersFullTime . stocks . currency ,
value : offerToUpdate.offersFullTime.stocks.value ,
value : offerToUpdate.offersFullTime.stocks.value ,
} ,
} ,
update : {
update : {
@ -1298,11 +1749,12 @@ export const offersProfileRouter = createRouter()
offerToUpdate . offersFullTime . stocks . currency ,
offerToUpdate . offersFullTime . stocks . currency ,
baseCurrencyString ,
baseCurrencyString ,
) ,
) ,
currency : offerToUpdate.offersFullTime.stocks.currency ,
currency :
offerToUpdate . offersFullTime . stocks . currency ,
value : offerToUpdate.offersFullTime.stocks.value ,
value : offerToUpdate.offersFullTime.stocks.value ,
}
} ,
}
} ,
}
} ,
} ,
} ,
where : {
where : {
id : offerToUpdate.offersFullTime.id ,
id : offerToUpdate.offersFullTime.id ,
@ -1317,24 +1769,32 @@ export const offersProfileRouter = createRouter()
baseCurrency : baseCurrencyString ,
baseCurrency : baseCurrencyString ,
baseValue : await convert (
baseValue : await convert (
offerToUpdate . offersFullTime . totalCompensation . value ,
offerToUpdate . offersFullTime . totalCompensation . value ,
offerToUpdate . offersFullTime . totalCompensation . currency ,
offerToUpdate . offersFullTime . totalCompensation
. currency ,
baseCurrencyString ,
baseCurrencyString ,
) ,
) ,
currency : offerToUpdate.offersFullTime.totalCompensation.currency ,
currency :
value : offerToUpdate.offersFullTime.totalCompensation.value ,
offerToUpdate . offersFullTime . totalCompensation
. currency ,
value :
offerToUpdate . offersFullTime . totalCompensation . value ,
} ,
} ,
update : {
update : {
baseCurrency : baseCurrencyString ,
baseCurrency : baseCurrencyString ,
baseValue : await convert (
baseValue : await convert (
offerToUpdate . offersFullTime . totalCompensation . value ,
offerToUpdate . offersFullTime . totalCompensation . value ,
offerToUpdate . offersFullTime . totalCompensation . currency ,
offerToUpdate . offersFullTime . totalCompensation
. currency ,
baseCurrencyString ,
baseCurrencyString ,
) ,
) ,
currency : offerToUpdate.offersFullTime.totalCompensation.currency ,
currency :
value : offerToUpdate.offersFullTime.totalCompensation.value ,
offerToUpdate . offersFullTime . totalCompensation
}
. currency ,
}
value :
}
offerToUpdate . offersFullTime . totalCompensation . value ,
} ,
} ,
} ,
} ,
} ,
where : {
where : {
id : offerToUpdate.offersFullTime.id ,
id : offerToUpdate.offersFullTime.id ,
@ -1362,7 +1822,11 @@ export const offersProfileRouter = createRouter()
} ,
} ,
} ,
} ,
jobType : offerToUpdate.jobType ,
jobType : offerToUpdate.jobType ,
location : offerToUpdate.location ,
location : {
connect : {
id : offerToUpdate.cityId
}
} ,
monthYearReceived : offerToUpdate.monthYearReceived ,
monthYearReceived : offerToUpdate.monthYearReceived ,
negotiationStrategy : offerToUpdate.negotiationStrategy ,
negotiationStrategy : offerToUpdate.negotiationStrategy ,
offersIntern : {
offersIntern : {
@ -1416,7 +1880,11 @@ export const offersProfileRouter = createRouter()
} ,
} ,
} ,
} ,
jobType : offerToUpdate.jobType ,
jobType : offerToUpdate.jobType ,
location : offerToUpdate.location ,
location : {
connect : {
id : offerToUpdate.cityId
}
} ,
monthYearReceived : offerToUpdate.monthYearReceived ,
monthYearReceived : offerToUpdate.monthYearReceived ,
negotiationStrategy : offerToUpdate.negotiationStrategy ,
negotiationStrategy : offerToUpdate.negotiationStrategy ,
offersFullTime : {
offersFullTime : {