fix bad merge
parent
4677f71923
commit
fe1f4627be
|
@ -83,7 +83,8 @@ export const bookingRouter = createRouter()
|
||||||
}),
|
}),
|
||||||
async resolve({ input, ctx }) {
|
async resolve({ input, ctx }) {
|
||||||
const { prisma } = ctx;
|
const { prisma } = ctx;
|
||||||
const { username, slug } = input;
|
const { username: userParam, slug: typeParam } = input;
|
||||||
|
|
||||||
const eventTypeSelect = Prisma.validator<Prisma.EventTypeSelect>()({
|
const eventTypeSelect = Prisma.validator<Prisma.EventTypeSelect>()({
|
||||||
id: true,
|
id: true,
|
||||||
title: true,
|
title: true,
|
||||||
|
@ -112,7 +113,7 @@ export const bookingRouter = createRouter()
|
||||||
|
|
||||||
const user = await prisma.user.findUnique({
|
const user = await prisma.user.findUnique({
|
||||||
where: {
|
where: {
|
||||||
username: username.toLowerCase(),
|
username: userParam.toLowerCase(),
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
|
@ -133,7 +134,7 @@ export const bookingRouter = createRouter()
|
||||||
where: {
|
where: {
|
||||||
AND: [
|
AND: [
|
||||||
{
|
{
|
||||||
slug,
|
slug: typeParam,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
teamId: null,
|
teamId: null,
|
||||||
|
@ -157,7 +158,7 @@ export const bookingRouter = createRouter()
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
slug,
|
slug: typeParam,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -203,13 +204,17 @@ export const bookingRouter = createRouter()
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (firstEventType?.id !== eventType.id) {
|
if (firstEventType?.id !== eventType.id) {
|
||||||
return {
|
return null;
|
||||||
notFound: true,
|
|
||||||
} as const;
|
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
const getWorkingHours = (availability: typeof user.availability | typeof eventType.availability) =>
|
const getWorkingHours = (availability: typeof user.availability | typeof eventType.availability) =>
|
||||||
availability && availability.length ? availability : null;
|
availability && availability.length
|
||||||
|
? availability.map((schedule) => ({
|
||||||
|
...schedule,
|
||||||
|
startTime: schedule.startTime.getUTCHours() * 60 + schedule.startTime.getUTCMinutes(),
|
||||||
|
endTime: schedule.endTime.getUTCHours() * 60 + schedule.endTime.getUTCMinutes(),
|
||||||
|
}))
|
||||||
|
: null;
|
||||||
|
|
||||||
const workingHours =
|
const workingHours =
|
||||||
getWorkingHours(eventType.availability) ||
|
getWorkingHours(eventType.availability) ||
|
||||||
|
@ -229,6 +234,8 @@ export const bookingRouter = createRouter()
|
||||||
periodEndDate: eventType.periodEndDate?.toString() ?? null,
|
periodEndDate: eventType.periodEndDate?.toString() ?? null,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
eventTypeObject.availability = [];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
profile: {
|
profile: {
|
||||||
name: user.name,
|
name: user.name,
|
||||||
|
|
Loading…
Reference in New Issue