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,6 +161,7 @@ export const offersProfileRouter = createRouter()
|
|||||||
x.totalCompensation?.currency !== undefined &&
|
x.totalCompensation?.currency !== undefined &&
|
||||||
x.totalCompensation.value !== undefined
|
x.totalCompensation.value !== undefined
|
||||||
) {
|
) {
|
||||||
|
if (x.companyId) {
|
||||||
return {
|
return {
|
||||||
company: {
|
company: {
|
||||||
connect: {
|
connect: {
|
||||||
@ -179,12 +180,28 @@ export const offersProfileRouter = createRouter()
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
durationInMonths: x.durationInMonths,
|
||||||
|
jobType: x.jobType,
|
||||||
|
level: x.level,
|
||||||
|
specialization: x.specialization,
|
||||||
|
title: x.title,
|
||||||
|
totalCompensation: {
|
||||||
|
create: {
|
||||||
|
currency: x.totalCompensation?.currency,
|
||||||
|
value: x.totalCompensation?.value,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
x.jobType === 'INTERN' &&
|
x.jobType === 'INTERN' &&
|
||||||
x.monthlySalary?.currency !== undefined &&
|
x.monthlySalary?.currency !== undefined &&
|
||||||
x.monthlySalary.value !== undefined
|
x.monthlySalary.value !== undefined
|
||||||
) {
|
) {
|
||||||
|
if (x.companyId) {
|
||||||
return {
|
return {
|
||||||
company: {
|
company: {
|
||||||
connect: {
|
connect: {
|
||||||
@ -203,6 +220,20 @@ export const offersProfileRouter = createRouter()
|
|||||||
title: x.title,
|
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