-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fb1bafe
commit 074b0b2
Showing
6 changed files
with
103 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 7 additions & 52 deletions
59
packages/features/bookings/lib/handleNewBooking/getOriginalRescheduledBooking.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 0 additions & 57 deletions
57
packages/features/bookings/lib/handleNewBooking/getOriginalRescheduledBookingAndSeat.ts
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
packages/features/bookings/lib/handleNewBooking/getSeatedBooking.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import prisma from "@calcom/prisma"; | ||
|
||
import type { BookingSeat } from "../handleSeats/types"; | ||
|
||
export const getSeatedBooking = async (bookingSeatUid: string): Promise<BookingSeat | null> => { | ||
// rescheduleUid can be bookingUid and bookingSeatUid | ||
return prisma.bookingSeat.findUnique({ | ||
where: { | ||
referenceUid: bookingSeatUid, | ||
}, | ||
include: { | ||
booking: true, | ||
attendee: true, | ||
}, | ||
}); | ||
}; |
20 changes: 20 additions & 0 deletions
20
packages/features/bookings/lib/handleNewBooking/validateOriginalRescheduledBooking.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { ErrorCode } from "@calcom/lib/errorCodes"; | ||
import { HttpError } from "@calcom/lib/http-error"; | ||
import { BookingStatus } from "@calcom/prisma/enums"; | ||
|
||
import { type OriginalRescheduledBooking } from "./getOriginalRescheduledBooking"; | ||
|
||
export const validateOriginalRescheduledBooking = async ( | ||
originalRescheduledBooking: OriginalRescheduledBooking | ||
) => { | ||
if (!originalRescheduledBooking) { | ||
throw new HttpError({ statusCode: 404, message: "Could not find original booking" }); | ||
} | ||
|
||
if ( | ||
originalRescheduledBooking.status === BookingStatus.CANCELLED && | ||
!originalRescheduledBooking.rescheduled | ||
) { | ||
throw new HttpError({ statusCode: 403, message: ErrorCode.CancelledBookingsCannotBeRescheduled }); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters