mirror of
https://github.com/hanzoai/calendar.git
synced 2026-10-30 14:46:43 +00:00
Co-authored-by: Udit Takkar <[email protected]> Co-authored-by: Udit Takkar <[email protected]>
40 lines
851 B
TypeScript
40 lines
851 B
TypeScript
import type { PrismaClient } from "@calcom/prisma";
|
|
import { BookingStatus } from "@calcom/prisma/enums";
|
|
|
|
import type { TInstantBookingInputSchema } from "./getInstantBookingLocation.schema";
|
|
|
|
type GetOptions = {
|
|
ctx: {
|
|
prisma: PrismaClient;
|
|
};
|
|
input: TInstantBookingInputSchema;
|
|
};
|
|
|
|
export const getHandler = async ({ ctx, input }: GetOptions) => {
|
|
const { prisma } = ctx;
|
|
const { bookingId } = input;
|
|
|
|
const booking = await prisma.booking.findUnique({
|
|
where: {
|
|
id: bookingId,
|
|
status: BookingStatus.ACCEPTED,
|
|
},
|
|
select: {
|
|
id: true,
|
|
uid: true,
|
|
location: true,
|
|
metadata: true,
|
|
startTime: true,
|
|
status: true,
|
|
endTime: true,
|
|
description: true,
|
|
eventTypeId: true,
|
|
},
|
|
});
|
|
|
|
// Don't leak anything private from the booking
|
|
return {
|
|
booking,
|
|
};
|
|
};
|