mirror of
https://github.com/yangshun/tech-interview-handbook.git
synced 2025-07-29 21:23:14 +08:00
[offers][fix] fix create endpoint no company bug
This commit is contained in:
@ -161,48 +161,79 @@ export const offersProfileRouter = createRouter()
|
|||||||
x.totalCompensation?.currency !== undefined &&
|
x.totalCompensation?.currency !== undefined &&
|
||||||
x.totalCompensation.value !== undefined
|
x.totalCompensation.value !== undefined
|
||||||
) {
|
) {
|
||||||
return {
|
if (x.companyId) {
|
||||||
company: {
|
return {
|
||||||
connect: {
|
company: {
|
||||||
id: x.companyId,
|
connect: {
|
||||||
},
|
id: x.companyId,
|
||||||
},
|
},
|
||||||
durationInMonths: x.durationInMonths,
|
},
|
||||||
jobType: x.jobType,
|
durationInMonths: x.durationInMonths,
|
||||||
level: x.level,
|
jobType: x.jobType,
|
||||||
specialization: x.specialization,
|
level: x.level,
|
||||||
title: x.title,
|
specialization: x.specialization,
|
||||||
totalCompensation: {
|
title: x.title,
|
||||||
create: {
|
totalCompensation: {
|
||||||
currency: x.totalCompensation?.currency,
|
create: {
|
||||||
value: x.totalCompensation?.value,
|
currency: x.totalCompensation?.currency,
|
||||||
},
|
value: x.totalCompensation?.value,
|
||||||
},
|
},
|
||||||
};
|
},
|
||||||
}
|
};
|
||||||
if (
|
}
|
||||||
x.jobType === 'INTERN' &&
|
return {
|
||||||
x.monthlySalary?.currency !== undefined &&
|
durationInMonths: x.durationInMonths,
|
||||||
x.monthlySalary.value !== undefined
|
jobType: x.jobType,
|
||||||
) {
|
level: x.level,
|
||||||
return {
|
specialization: x.specialization,
|
||||||
company: {
|
title: x.title,
|
||||||
connect: {
|
totalCompensation: {
|
||||||
id: x.companyId,
|
create: {
|
||||||
},
|
currency: x.totalCompensation?.currency,
|
||||||
},
|
value: x.totalCompensation?.value,
|
||||||
durationInMonths: x.durationInMonths,
|
},
|
||||||
jobType: x.jobType,
|
},
|
||||||
monthlySalary: {
|
};
|
||||||
create: {
|
|
||||||
currency: x.monthlySalary?.currency,
|
|
||||||
value: x.monthlySalary?.value,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
specialization: x.specialization,
|
|
||||||
title: x.title,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
x.jobType === 'INTERN' &&
|
||||||
|
x.monthlySalary?.currency !== undefined &&
|
||||||
|
x.monthlySalary.value !== undefined
|
||||||
|
) {
|
||||||
|
if (x.companyId) {
|
||||||
|
return {
|
||||||
|
company: {
|
||||||
|
connect: {
|
||||||
|
id: x.companyId,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
durationInMonths: x.durationInMonths,
|
||||||
|
jobType: x.jobType,
|
||||||
|
monthlySalary: {
|
||||||
|
create: {
|
||||||
|
currency: x.monthlySalary?.currency,
|
||||||
|
value: x.monthlySalary?.value,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
specialization: x.specialization,
|
||||||
|
title: x.title,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
durationInMonths: x.durationInMonths,
|
||||||
|
jobType: x.jobType,
|
||||||
|
monthlySalary: {
|
||||||
|
create: {
|
||||||
|
currency: x.monthlySalary?.currency,
|
||||||
|
value: x.monthlySalary?.value,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
specialization: x.specialization,
|
||||||
|
title: x.title,
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
throw Prisma.PrismaClientKnownRequestError;
|
throw Prisma.PrismaClientKnownRequestError;
|
||||||
}),
|
}),
|
||||||
|
Reference in New Issue
Block a user