[offers][fix] remove compulsory tc and monthly salary for past exp

pull/413/head
Stuart Long Chay Boon 2 years ago
parent 6948c2e4ee
commit b0329a04f0

@ -754,11 +754,9 @@ export const offersProfileRouter = createRouter()
} }
} else if (!exp.id) { } else if (!exp.id) {
// Create new experience // Create new experience
if ( if (exp.jobType === JobType.FULLTIME) {
exp.jobType === JobType.FULLTIME && if (exp.totalCompensation?.currency != null &&
exp.totalCompensation?.currency != null && exp.totalCompensation?.value != null) {
exp.totalCompensation?.value != null
) {
if (exp.companyId) { if (exp.companyId) {
await ctx.prisma.offersBackground.update({ await ctx.prisma.offersBackground.update({
data: { data: {
@ -825,11 +823,51 @@ export const offersProfileRouter = createRouter()
}, },
}); });
} }
} else if ( } else if (exp.companyId) {
exp.jobType === JobType.INTERN && await ctx.prisma.offersBackground.update({
exp.monthlySalary?.currency != null && data: {
exp.monthlySalary?.value != null experiences: {
) { create: {
company: {
connect: {
id: exp.companyId,
},
},
durationInMonths: exp.durationInMonths,
jobType: exp.jobType,
level: exp.level,
location: exp.location,
specialization: exp.specialization,
title: exp.title,
},
},
},
where: {
id: input.background.id,
},
});
} else {
await ctx.prisma.offersBackground.update({
data: {
experiences: {
create: {
durationInMonths: exp.durationInMonths,
jobType: exp.jobType,
level: exp.level,
location: exp.location,
specialization: exp.specialization,
title: exp.title,
},
},
},
where: {
id: input.background.id,
},
});
}
} else if (exp.jobType === JobType.INTERN) {
if (exp.monthlySalary?.currency != null &&
exp.monthlySalary?.value != null) {
if (exp.companyId) { if (exp.companyId) {
await ctx.prisma.offersBackground.update({ await ctx.prisma.offersBackground.update({
data: { data: {
@ -894,6 +932,46 @@ export const offersProfileRouter = createRouter()
}, },
}); });
} }
} else if (exp.companyId) {
await ctx.prisma.offersBackground.update({
data: {
experiences: {
create: {
company: {
connect: {
id: exp.companyId,
},
},
durationInMonths: exp.durationInMonths,
jobType: exp.jobType,
location: exp.location,
specialization: exp.specialization,
title: exp.title,
},
},
},
where: {
id: input.background.id,
},
});
} else {
await ctx.prisma.offersBackground.update({
data: {
experiences: {
create: {
durationInMonths: exp.durationInMonths,
jobType: exp.jobType,
location: exp.location,
specialization: exp.specialization,
title: exp.title,
},
},
},
where: {
id: input.background.id,
},
});
}
} }
} }
} }

Loading…
Cancel
Save