|
|
@ -707,7 +707,7 @@ export const offersProfileRouter = createRouter()
|
|
|
|
// Update existing experience
|
|
|
|
// Update existing experience
|
|
|
|
await ctx.prisma.offersExperience.update({
|
|
|
|
await ctx.prisma.offersExperience.update({
|
|
|
|
data: {
|
|
|
|
data: {
|
|
|
|
companyId: exp.companyId,
|
|
|
|
companyId: exp.companyId, // TODO: check if can change with connect or whether there is a difference
|
|
|
|
durationInMonths: exp.durationInMonths,
|
|
|
|
durationInMonths: exp.durationInMonths,
|
|
|
|
level: exp.level,
|
|
|
|
level: exp.level,
|
|
|
|
specialization: exp.specialization,
|
|
|
|
specialization: exp.specialization,
|
|
|
@ -718,6 +718,7 @@ export const offersProfileRouter = createRouter()
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (exp.monthlySalary) {
|
|
|
|
if (exp.monthlySalary) {
|
|
|
|
|
|
|
|
if (exp.monthlySalary.id) {
|
|
|
|
await ctx.prisma.offersCurrency.update({
|
|
|
|
await ctx.prisma.offersCurrency.update({
|
|
|
|
data: {
|
|
|
|
data: {
|
|
|
|
baseCurrency: baseCurrencyString,
|
|
|
|
baseCurrency: baseCurrencyString,
|
|
|
@ -733,9 +734,31 @@ export const offersProfileRouter = createRouter()
|
|
|
|
id: exp.monthlySalary.id,
|
|
|
|
id: exp.monthlySalary.id,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
await ctx.prisma.offersExperience.update({
|
|
|
|
|
|
|
|
data: {
|
|
|
|
|
|
|
|
monthlySalary: {
|
|
|
|
|
|
|
|
create: {
|
|
|
|
|
|
|
|
baseCurrency: baseCurrencyString,
|
|
|
|
|
|
|
|
baseValue: await convert(
|
|
|
|
|
|
|
|
exp.monthlySalary.value,
|
|
|
|
|
|
|
|
exp.monthlySalary.currency,
|
|
|
|
|
|
|
|
baseCurrencyString,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
currency: exp.monthlySalary.currency,
|
|
|
|
|
|
|
|
value: exp.monthlySalary.value,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
where: {
|
|
|
|
|
|
|
|
id: exp.id,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (exp.totalCompensation) {
|
|
|
|
if (exp.totalCompensation) {
|
|
|
|
|
|
|
|
if (exp.totalCompensation.id) {
|
|
|
|
await ctx.prisma.offersCurrency.update({
|
|
|
|
await ctx.prisma.offersCurrency.update({
|
|
|
|
data: {
|
|
|
|
data: {
|
|
|
|
baseCurrency: baseCurrencyString,
|
|
|
|
baseCurrency: baseCurrencyString,
|
|
|
@ -751,6 +774,27 @@ export const offersProfileRouter = createRouter()
|
|
|
|
id: exp.totalCompensation.id,
|
|
|
|
id: exp.totalCompensation.id,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
await ctx.prisma.offersExperience.update({
|
|
|
|
|
|
|
|
data: {
|
|
|
|
|
|
|
|
totalCompensation: {
|
|
|
|
|
|
|
|
create: {
|
|
|
|
|
|
|
|
baseCurrency: baseCurrencyString,
|
|
|
|
|
|
|
|
baseValue: await convert(
|
|
|
|
|
|
|
|
exp.totalCompensation.value,
|
|
|
|
|
|
|
|
exp.totalCompensation.currency,
|
|
|
|
|
|
|
|
baseCurrencyString,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
currency: exp.totalCompensation.currency,
|
|
|
|
|
|
|
|
value: exp.totalCompensation.value,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
where: {
|
|
|
|
|
|
|
|
id: exp.id,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (!exp.id) {
|
|
|
|
} else if (!exp.id) {
|
|
|
|
// Create new experience
|
|
|
|
// Create new experience
|
|
|
|