|
|
|
@ -1035,7 +1035,9 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
exp.totalCompensation?.currency != null &&
|
|
|
|
|
exp.totalCompensation?.value != null
|
|
|
|
|
) {
|
|
|
|
|
// FULLTIME
|
|
|
|
|
if (exp.companyId) {
|
|
|
|
|
if (exp.cityId) {
|
|
|
|
|
await ctx.prisma.offersBackground.update({
|
|
|
|
|
data: {
|
|
|
|
|
experiences: {
|
|
|
|
@ -1048,7 +1050,11 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
durationInMonths: exp.durationInMonths,
|
|
|
|
|
jobType: exp.jobType,
|
|
|
|
|
level: exp.level,
|
|
|
|
|
location: exp.location,
|
|
|
|
|
location: {
|
|
|
|
|
connect: {
|
|
|
|
|
id: exp.cityId
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
title: exp.title,
|
|
|
|
|
totalCompensation: exp.totalCompensation
|
|
|
|
|
? {
|
|
|
|
@ -1071,6 +1077,75 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
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({
|
|
|
|
|
data: {
|
|
|
|
|
experiences: {
|
|
|
|
|
create: {
|
|
|
|
|
durationInMonths: exp.durationInMonths,
|
|
|
|
|
jobType: exp.jobType,
|
|
|
|
|
level: exp.level,
|
|
|
|
|
location: {
|
|
|
|
|
connect: {
|
|
|
|
|
id: exp.cityId
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
title: exp.title,
|
|
|
|
|
totalCompensation: {
|
|
|
|
|
create: {
|
|
|
|
|
baseCurrency: baseCurrencyString,
|
|
|
|
|
baseValue: await convert(
|
|
|
|
|
exp.totalCompensation.value,
|
|
|
|
|
exp.totalCompensation.currency,
|
|
|
|
|
baseCurrencyString,
|
|
|
|
|
),
|
|
|
|
|
currency: exp.totalCompensation.currency,
|
|
|
|
|
value: exp.totalCompensation.value,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
where: {
|
|
|
|
|
id: input.background.id,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
await ctx.prisma.offersBackground.update({
|
|
|
|
|
data: {
|
|
|
|
@ -1079,7 +1154,6 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
durationInMonths: exp.durationInMonths,
|
|
|
|
|
jobType: exp.jobType,
|
|
|
|
|
level: exp.level,
|
|
|
|
|
location: exp.location,
|
|
|
|
|
title: exp.title,
|
|
|
|
|
totalCompensation: {
|
|
|
|
|
create: {
|
|
|
|
@ -1102,6 +1176,33 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} 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: {
|
|
|
|
@ -1114,7 +1215,28 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
durationInMonths: exp.durationInMonths,
|
|
|
|
|
jobType: exp.jobType,
|
|
|
|
|
level: exp.level,
|
|
|
|
|
location: exp.location,
|
|
|
|
|
title: exp.title,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
where: {
|
|
|
|
|
id: input.background.id,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else if (exp.cityId) {
|
|
|
|
|
await ctx.prisma.offersBackground.update({
|
|
|
|
|
data: {
|
|
|
|
|
experiences: {
|
|
|
|
|
create: {
|
|
|
|
|
durationInMonths: exp.durationInMonths,
|
|
|
|
|
jobType: exp.jobType,
|
|
|
|
|
level: exp.level,
|
|
|
|
|
location: {
|
|
|
|
|
connect: {
|
|
|
|
|
id: exp.cityId
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
title: exp.title,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
@ -1131,7 +1253,6 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
durationInMonths: exp.durationInMonths,
|
|
|
|
|
jobType: exp.jobType,
|
|
|
|
|
level: exp.level,
|
|
|
|
|
location: exp.location,
|
|
|
|
|
title: exp.title,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
@ -1146,7 +1267,46 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
exp.monthlySalary?.currency != null &&
|
|
|
|
|
exp.monthlySalary?.value != null
|
|
|
|
|
) {
|
|
|
|
|
// INTERN
|
|
|
|
|
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: {
|
|
|
|
@ -1158,7 +1318,39 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
},
|
|
|
|
|
durationInMonths: exp.durationInMonths,
|
|
|
|
|
jobType: exp.jobType,
|
|
|
|
|
location: exp.location,
|
|
|
|
|
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({
|
|
|
|
|
data: {
|
|
|
|
|
experiences: {
|
|
|
|
|
create: {
|
|
|
|
|
durationInMonths: exp.durationInMonths,
|
|
|
|
|
jobType: exp.jobType,
|
|
|
|
|
location: {
|
|
|
|
|
connect: {
|
|
|
|
|
id: exp.cityId
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
monthlySalary: {
|
|
|
|
|
create: {
|
|
|
|
|
baseCurrency: baseCurrencyString,
|
|
|
|
@ -1186,7 +1378,6 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
create: {
|
|
|
|
|
durationInMonths: exp.durationInMonths,
|
|
|
|
|
jobType: exp.jobType,
|
|
|
|
|
location: exp.location,
|
|
|
|
|
monthlySalary: {
|
|
|
|
|
create: {
|
|
|
|
|
baseCurrency: baseCurrencyString,
|
|
|
|
@ -1209,6 +1400,32 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} 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: {
|
|
|
|
@ -1220,7 +1437,27 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
},
|
|
|
|
|
durationInMonths: exp.durationInMonths,
|
|
|
|
|
jobType: exp.jobType,
|
|
|
|
|
location: exp.location,
|
|
|
|
|
title: exp.title,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
where: {
|
|
|
|
|
id: input.background.id,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else if (exp.cityId) {
|
|
|
|
|
await ctx.prisma.offersBackground.update({
|
|
|
|
|
data: {
|
|
|
|
|
experiences: {
|
|
|
|
|
create: {
|
|
|
|
|
durationInMonths: exp.durationInMonths,
|
|
|
|
|
jobType: exp.jobType,
|
|
|
|
|
location: {
|
|
|
|
|
connect: {
|
|
|
|
|
id: exp.cityId
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
title: exp.title,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
@ -1236,7 +1473,6 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
create: {
|
|
|
|
|
durationInMonths: exp.durationInMonths,
|
|
|
|
|
jobType: exp.jobType,
|
|
|
|
|
location: exp.location,
|
|
|
|
|
title: exp.title,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
@ -1324,12 +1560,20 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
await ctx.prisma.offersOffer.update({
|
|
|
|
|
data: {
|
|
|
|
|
comments: offerToUpdate.comments,
|
|
|
|
|
companyId: offerToUpdate.companyId,
|
|
|
|
|
company: {
|
|
|
|
|
connect: {
|
|
|
|
|
id: offerToUpdate.companyId
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
jobType:
|
|
|
|
|
offerToUpdate.jobType === JobType.FULLTIME
|
|
|
|
|
? JobType.FULLTIME
|
|
|
|
|
: JobType.INTERN,
|
|
|
|
|
location: offerToUpdate.location,
|
|
|
|
|
location: {
|
|
|
|
|
connect: {
|
|
|
|
|
id: offerToUpdate.cityId
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
monthYearReceived: offerToUpdate.monthYearReceived,
|
|
|
|
|
negotiationStrategy: offerToUpdate.negotiationStrategy,
|
|
|
|
|
},
|
|
|
|
@ -1466,7 +1710,11 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
jobType: offerToUpdate.jobType,
|
|
|
|
|
location: offerToUpdate.location,
|
|
|
|
|
location: {
|
|
|
|
|
connect: {
|
|
|
|
|
id: offerToUpdate.cityId
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
monthYearReceived: offerToUpdate.monthYearReceived,
|
|
|
|
|
negotiationStrategy: offerToUpdate.negotiationStrategy,
|
|
|
|
|
offersIntern: {
|
|
|
|
@ -1520,7 +1768,11 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
jobType: offerToUpdate.jobType,
|
|
|
|
|
location: offerToUpdate.location,
|
|
|
|
|
location: {
|
|
|
|
|
connect: {
|
|
|
|
|
id: offerToUpdate.cityId
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
monthYearReceived: offerToUpdate.monthYearReceived,
|
|
|
|
|
negotiationStrategy: offerToUpdate.negotiationStrategy,
|
|
|
|
|
offersFullTime: {
|
|
|
|
|