|
|
|
@ -35,12 +35,12 @@ const company = z.object({
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const offer = z.object({
|
|
|
|
|
cityId: z.string(),
|
|
|
|
|
comments: z.string(),
|
|
|
|
|
company: company.nullish(),
|
|
|
|
|
companyId: z.string(),
|
|
|
|
|
id: z.string().optional(),
|
|
|
|
|
jobType: z.string().regex(createValidationRegex(Object.keys(JobType), null)),
|
|
|
|
|
location: z.string(),
|
|
|
|
|
monthYearReceived: z.date(),
|
|
|
|
|
negotiationStrategy: z.string(),
|
|
|
|
|
offersFullTime: z
|
|
|
|
@ -75,6 +75,7 @@ const offer = z.object({
|
|
|
|
|
|
|
|
|
|
const experience = z.object({
|
|
|
|
|
backgroundId: z.string().nullish(),
|
|
|
|
|
cityId: z.string().nullish(),
|
|
|
|
|
company: company.nullish(),
|
|
|
|
|
companyId: z.string().nullish(),
|
|
|
|
|
durationInMonths: z.number().nullish(),
|
|
|
|
@ -84,7 +85,6 @@ const experience = z.object({
|
|
|
|
|
.regex(createValidationRegex(Object.keys(JobType), null))
|
|
|
|
|
.nullish(),
|
|
|
|
|
level: z.string().nullish(),
|
|
|
|
|
location: z.string().nullish(),
|
|
|
|
|
monthlySalary: valuation.nullish(),
|
|
|
|
|
monthlySalaryId: z.string().nullish(),
|
|
|
|
|
title: z.string().nullish(),
|
|
|
|
@ -171,6 +171,15 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
topSimilarOffers: {
|
|
|
|
|
include: {
|
|
|
|
|
company: true,
|
|
|
|
|
location: {
|
|
|
|
|
include: {
|
|
|
|
|
state: {
|
|
|
|
|
include: {
|
|
|
|
|
country: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
offersFullTime: {
|
|
|
|
|
include: {
|
|
|
|
|
totalCompensation: true,
|
|
|
|
@ -188,6 +197,15 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
experiences: {
|
|
|
|
|
include: {
|
|
|
|
|
company: true,
|
|
|
|
|
location: {
|
|
|
|
|
include: {
|
|
|
|
|
state: {
|
|
|
|
|
include: {
|
|
|
|
|
country: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
@ -203,6 +221,15 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
topSimilarOffers: {
|
|
|
|
|
include: {
|
|
|
|
|
company: true,
|
|
|
|
|
location: {
|
|
|
|
|
include: {
|
|
|
|
|
state: {
|
|
|
|
|
include: {
|
|
|
|
|
country: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
offersFullTime: {
|
|
|
|
|
include: {
|
|
|
|
|
totalCompensation: true,
|
|
|
|
@ -220,6 +247,15 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
experiences: {
|
|
|
|
|
include: {
|
|
|
|
|
company: true,
|
|
|
|
|
location: {
|
|
|
|
|
include: {
|
|
|
|
|
state: {
|
|
|
|
|
include: {
|
|
|
|
|
country: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
@ -233,6 +269,15 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
overallHighestOffer: {
|
|
|
|
|
include: {
|
|
|
|
|
company: true,
|
|
|
|
|
location: {
|
|
|
|
|
include: {
|
|
|
|
|
state: {
|
|
|
|
|
include: {
|
|
|
|
|
country: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
offersFullTime: {
|
|
|
|
|
include: {
|
|
|
|
|
totalCompensation: true,
|
|
|
|
@ -258,6 +303,15 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
experiences: {
|
|
|
|
|
include: {
|
|
|
|
|
company: true,
|
|
|
|
|
location: {
|
|
|
|
|
include: {
|
|
|
|
|
state: {
|
|
|
|
|
include: {
|
|
|
|
|
country: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
monthlySalary: true,
|
|
|
|
|
totalCompensation: true,
|
|
|
|
|
},
|
|
|
|
@ -275,6 +329,15 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
offers: {
|
|
|
|
|
include: {
|
|
|
|
|
company: true,
|
|
|
|
|
location: {
|
|
|
|
|
include: {
|
|
|
|
|
state: {
|
|
|
|
|
include: {
|
|
|
|
|
country: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
offersFullTime: {
|
|
|
|
|
include: {
|
|
|
|
|
baseSalary: true,
|
|
|
|
@ -350,6 +413,39 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
input.background.experiences.map(async (x) => {
|
|
|
|
|
if (x.jobType === JobType.FULLTIME) {
|
|
|
|
|
if (x.companyId) {
|
|
|
|
|
if (x.cityId) {
|
|
|
|
|
return {
|
|
|
|
|
company: {
|
|
|
|
|
connect: {
|
|
|
|
|
id: x.companyId,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
durationInMonths: x.durationInMonths,
|
|
|
|
|
jobType: x.jobType,
|
|
|
|
|
level: x.level,
|
|
|
|
|
location: {
|
|
|
|
|
connect: {
|
|
|
|
|
id: x.cityId
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
title: x.title,
|
|
|
|
|
totalCompensation:
|
|
|
|
|
x.totalCompensation != null
|
|
|
|
|
? {
|
|
|
|
|
create: {
|
|
|
|
|
baseCurrency: baseCurrencyString,
|
|
|
|
|
baseValue: await convert(
|
|
|
|
|
x.totalCompensation.value,
|
|
|
|
|
x.totalCompensation.currency,
|
|
|
|
|
baseCurrencyString,
|
|
|
|
|
),
|
|
|
|
|
currency: x.totalCompensation.currency,
|
|
|
|
|
value: x.totalCompensation.value,
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
: undefined,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
company: {
|
|
|
|
|
connect: {
|
|
|
|
@ -377,11 +473,40 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
: undefined,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
if (x.cityId) {
|
|
|
|
|
return {
|
|
|
|
|
durationInMonths: x.durationInMonths,
|
|
|
|
|
jobType: x.jobType,
|
|
|
|
|
level: x.level,
|
|
|
|
|
location: {
|
|
|
|
|
connect: {
|
|
|
|
|
where: {
|
|
|
|
|
id: x.cityId
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
title: x.title,
|
|
|
|
|
totalCompensation:
|
|
|
|
|
x.totalCompensation != null
|
|
|
|
|
? {
|
|
|
|
|
create: {
|
|
|
|
|
baseCurrency: baseCurrencyString,
|
|
|
|
|
baseValue: await convert(
|
|
|
|
|
x.totalCompensation.value,
|
|
|
|
|
x.totalCompensation.currency,
|
|
|
|
|
baseCurrencyString,
|
|
|
|
|
),
|
|
|
|
|
currency: x.totalCompensation.currency,
|
|
|
|
|
value: x.totalCompensation.value,
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
: undefined,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
durationInMonths: x.durationInMonths,
|
|
|
|
|
jobType: x.jobType,
|
|
|
|
|
level: x.level,
|
|
|
|
|
location: x.location,
|
|
|
|
|
title: x.title,
|
|
|
|
|
totalCompensation:
|
|
|
|
|
x.totalCompensation != null
|
|
|
|
@ -402,6 +527,40 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
}
|
|
|
|
|
if (x.jobType === JobType.INTERN) {
|
|
|
|
|
if (x.companyId) {
|
|
|
|
|
if (x.cityId) {
|
|
|
|
|
return {
|
|
|
|
|
company: {
|
|
|
|
|
connect: {
|
|
|
|
|
id: x.companyId,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
durationInMonths: x.durationInMonths,
|
|
|
|
|
jobType: x.jobType,
|
|
|
|
|
location: {
|
|
|
|
|
connect: {
|
|
|
|
|
where: {
|
|
|
|
|
id: x.cityId
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
monthlySalary:
|
|
|
|
|
x.monthlySalary != null
|
|
|
|
|
? {
|
|
|
|
|
create: {
|
|
|
|
|
baseCurrency: baseCurrencyString,
|
|
|
|
|
baseValue: await convert(
|
|
|
|
|
x.monthlySalary.value,
|
|
|
|
|
x.monthlySalary.currency,
|
|
|
|
|
baseCurrencyString,
|
|
|
|
|
),
|
|
|
|
|
currency: x.monthlySalary.currency,
|
|
|
|
|
value: x.monthlySalary.value,
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
: undefined,
|
|
|
|
|
title: x.title,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
company: {
|
|
|
|
|
connect: {
|
|
|
|
@ -428,6 +587,37 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
title: x.title,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (x.cityId) {
|
|
|
|
|
return {
|
|
|
|
|
durationInMonths: x.durationInMonths,
|
|
|
|
|
jobType: x.jobType,
|
|
|
|
|
location: {
|
|
|
|
|
connect: {
|
|
|
|
|
where: {
|
|
|
|
|
id: x.cityId
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
monthlySalary:
|
|
|
|
|
x.monthlySalary != null
|
|
|
|
|
? {
|
|
|
|
|
create: {
|
|
|
|
|
baseCurrency: baseCurrencyString,
|
|
|
|
|
baseValue: await convert(
|
|
|
|
|
x.monthlySalary.value,
|
|
|
|
|
x.monthlySalary.currency,
|
|
|
|
|
baseCurrencyString,
|
|
|
|
|
),
|
|
|
|
|
currency: x.monthlySalary.currency,
|
|
|
|
|
value: x.monthlySalary.value,
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
: undefined,
|
|
|
|
|
title: x.title,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
durationInMonths: x.durationInMonths,
|
|
|
|
|
jobType: x.jobType,
|
|
|
|
@ -488,7 +678,13 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
jobType: x.jobType,
|
|
|
|
|
location: x.location,
|
|
|
|
|
location: {
|
|
|
|
|
connect: {
|
|
|
|
|
where: {
|
|
|
|
|
id: x.cityId
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
monthYearReceived: x.monthYearReceived,
|
|
|
|
|
negotiationStrategy: x.negotiationStrategy,
|
|
|
|
|
offersIntern: {
|
|
|
|
@ -528,7 +724,13 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
jobType: x.jobType,
|
|
|
|
|
location: x.location,
|
|
|
|
|
location: {
|
|
|
|
|
connect: {
|
|
|
|
|
where: {
|
|
|
|
|
id: x.cityId
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
monthYearReceived: x.monthYearReceived,
|
|
|
|
|
negotiationStrategy: x.negotiationStrategy,
|
|
|
|
|
offersFullTime: {
|
|
|
|
@ -871,35 +1073,110 @@ 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: {
|
|
|
|
|
create: {
|
|
|
|
|
company: {
|
|
|
|
|
connect: {
|
|
|
|
|
id: exp.companyId,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
durationInMonths: exp.durationInMonths,
|
|
|
|
|
jobType: exp.jobType,
|
|
|
|
|
level: exp.level,
|
|
|
|
|
location: {
|
|
|
|
|
connect: {
|
|
|
|
|
id: exp.cityId
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
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 {
|
|
|
|
|
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: {
|
|
|
|
|
company: {
|
|
|
|
|
connect: {
|
|
|
|
|
id: exp.companyId,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
durationInMonths: exp.durationInMonths,
|
|
|
|
|
jobType: exp.jobType,
|
|
|
|
|
level: exp.level,
|
|
|
|
|
location: exp.location,
|
|
|
|
|
location: {
|
|
|
|
|
connect: {
|
|
|
|
|
id: exp.cityId
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
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,
|
|
|
|
|
totalCompensation: {
|
|
|
|
|
create: {
|
|
|
|
|
baseCurrency: baseCurrencyString,
|
|
|
|
|
baseValue: await convert(
|
|
|
|
|
exp.totalCompensation.value,
|
|
|
|
|
exp.totalCompensation.currency,
|
|
|
|
|
baseCurrencyString,
|
|
|
|
|
),
|
|
|
|
|
currency: exp.totalCompensation.currency,
|
|
|
|
|
value: exp.totalCompensation.value,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
@ -915,7 +1192,6 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
durationInMonths: exp.durationInMonths,
|
|
|
|
|
jobType: exp.jobType,
|
|
|
|
|
level: exp.level,
|
|
|
|
|
location: exp.location,
|
|
|
|
|
title: exp.title,
|
|
|
|
|
totalCompensation: {
|
|
|
|
|
create: {
|
|
|
|
@ -938,19 +1214,67 @@ 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: {
|
|
|
|
|
create: {
|
|
|
|
|
company: {
|
|
|
|
|
connect: {
|
|
|
|
|
id: exp.companyId,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
durationInMonths: exp.durationInMonths,
|
|
|
|
|
jobType: exp.jobType,
|
|
|
|
|
level: exp.level,
|
|
|
|
|
title: exp.title,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
where: {
|
|
|
|
|
id: input.background.id,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else 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: exp.location,
|
|
|
|
|
location: {
|
|
|
|
|
connect: {
|
|
|
|
|
id: exp.cityId
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
title: exp.title,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
@ -967,7 +1291,6 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
durationInMonths: exp.durationInMonths,
|
|
|
|
|
jobType: exp.jobType,
|
|
|
|
|
level: exp.level,
|
|
|
|
|
location: exp.location,
|
|
|
|
|
title: exp.title,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
@ -982,19 +1305,90 @@ 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: {
|
|
|
|
|
create: {
|
|
|
|
|
company: {
|
|
|
|
|
connect: {
|
|
|
|
|
id: exp.companyId,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
durationInMonths: exp.durationInMonths,
|
|
|
|
|
jobType: exp.jobType,
|
|
|
|
|
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: {
|
|
|
|
|
company: {
|
|
|
|
|
connect: {
|
|
|
|
|
id: exp.companyId,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
durationInMonths: exp.durationInMonths,
|
|
|
|
|
jobType: exp.jobType,
|
|
|
|
|
location: exp.location,
|
|
|
|
|
location: {
|
|
|
|
|
connect: {
|
|
|
|
|
id: exp.cityId
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
monthlySalary: {
|
|
|
|
|
create: {
|
|
|
|
|
baseCurrency: baseCurrencyString,
|
|
|
|
@ -1022,7 +1416,6 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
create: {
|
|
|
|
|
durationInMonths: exp.durationInMonths,
|
|
|
|
|
jobType: exp.jobType,
|
|
|
|
|
location: exp.location,
|
|
|
|
|
monthlySalary: {
|
|
|
|
|
create: {
|
|
|
|
|
baseCurrency: baseCurrencyString,
|
|
|
|
@ -1045,18 +1438,64 @@ 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: {
|
|
|
|
|
create: {
|
|
|
|
|
company: {
|
|
|
|
|
connect: {
|
|
|
|
|
id: exp.companyId,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
durationInMonths: exp.durationInMonths,
|
|
|
|
|
jobType: exp.jobType,
|
|
|
|
|
title: exp.title,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
where: {
|
|
|
|
|
id: input.background.id,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else if (exp.cityId) {
|
|
|
|
|
await ctx.prisma.offersBackground.update({
|
|
|
|
|
data: {
|
|
|
|
|
experiences: {
|
|
|
|
|
create: {
|
|
|
|
|
company: {
|
|
|
|
|
connect: {
|
|
|
|
|
id: exp.companyId,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
durationInMonths: exp.durationInMonths,
|
|
|
|
|
jobType: exp.jobType,
|
|
|
|
|
location: exp.location,
|
|
|
|
|
location: {
|
|
|
|
|
connect: {
|
|
|
|
|
id: exp.cityId
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
title: exp.title,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
@ -1072,7 +1511,6 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
create: {
|
|
|
|
|
durationInMonths: exp.durationInMonths,
|
|
|
|
|
jobType: exp.jobType,
|
|
|
|
|
location: exp.location,
|
|
|
|
|
title: exp.title,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
@ -1160,12 +1598,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,
|
|
|
|
|
},
|
|
|
|
@ -1302,7 +1748,11 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
jobType: offerToUpdate.jobType,
|
|
|
|
|
location: offerToUpdate.location,
|
|
|
|
|
location: {
|
|
|
|
|
connect: {
|
|
|
|
|
id: offerToUpdate.cityId
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
monthYearReceived: offerToUpdate.monthYearReceived,
|
|
|
|
|
negotiationStrategy: offerToUpdate.negotiationStrategy,
|
|
|
|
|
offersIntern: {
|
|
|
|
@ -1356,7 +1806,11 @@ export const offersProfileRouter = createRouter()
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
jobType: offerToUpdate.jobType,
|
|
|
|
|
location: offerToUpdate.location,
|
|
|
|
|
location: {
|
|
|
|
|
connect: {
|
|
|
|
|
id: offerToUpdate.cityId
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
monthYearReceived: offerToUpdate.monthYearReceived,
|
|
|
|
|
negotiationStrategy: offerToUpdate.negotiationStrategy,
|
|
|
|
|
offersFullTime: {
|
|
|
|
|