Booking confirm endpoint refactoring (#2949)
* Adds new default handler and responder * Moved confirm endpoint * Fixes availability for unconfirmed bookings * Cleanup * Update _patch.ts * Prevent too much diffs * Adds missing BookingStatus * Migrates confirmed & rejected to status * Adds requiresConfirmation icon to listing * Adds booking status migration * Adds migrations to remove confirmed/rejected * Undo refactor * Sets the organizer as "accepted" in gCal * Update getBusyTimes.ts Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
3b321e5d3c
commit
12d66cb9df
27 files changed
+393
-336
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { Credential, SelectedCalendar } from "@prisma/client";
|
||||
import { BookingStatus, Credential, SelectedCalendar } from "@prisma/client";
|
||||
|
||||
import { getBusyCalendarTimes } from "@calcom/core/CalendarManager";
|
||||
import { getBusyVideoTimes } from "@calcom/core/videoClient";
|
||||
@@ -19,24 +19,13 @@ async function getBusyTimes(params: {
|
||||
const busyTimes: EventBusyDate[] = await prisma.booking
|
||||
.findMany({
|
||||
where: {
|
||||
AND: [
|
||||
{
|
||||
userId,
|
||||
eventTypeId,
|
||||
startTime: { gte: new Date(startTime) },
|
||||
endTime: { lte: new Date(endTime) },
|
||||
},
|
||||
{
|
||||
OR: [
|
||||
{
|
||||
status: "ACCEPTED",
|
||||
},
|
||||
{
|
||||
status: "PENDING",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
userId,
|
||||
eventTypeId,
|
||||
startTime: { gte: new Date(startTime) },
|
||||
endTime: { lte: new Date(endTime) },
|
||||
status: {
|
||||
in: [BookingStatus.ACCEPTED],
|
||||
},
|
||||
},
|
||||
select: {
|
||||
startTime: true,
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { Prisma, UserPlan } from "@prisma/client";
|
||||
|
||||
import { baseEventTypeSelect } from "@calcom/prisma";
|
||||
|
||||
import prisma from "@lib/prisma";
|
||||
|
||||
type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (...args: any) => Promise<infer R>
|
||||
@@ -37,18 +39,10 @@ export async function getTeamWithMembers(id?: number, slug?: string) {
|
||||
hidden: false,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
description: true,
|
||||
length: true,
|
||||
slug: true,
|
||||
schedulingType: true,
|
||||
recurringEvent: true,
|
||||
price: true,
|
||||
currency: true,
|
||||
users: {
|
||||
select: userSelect,
|
||||
},
|
||||
...baseEventTypeSelect,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
import { Attendee, Booking } from "@prisma/client";
|
||||
|
||||
export type BookingConfirmBody = {
|
||||
confirmed: boolean;
|
||||
id: number;
|
||||
};
|
||||
|
||||
export type BookingCreateBody = {
|
||||
email: string;
|
||||
end: string;
|
||||
|
||||
Reference in new issue
Block a user