Handle cancelled status (#19272)
This commit is contained in:
@@ -23,7 +23,6 @@ export async function createCRMEvent(payload: string): Promise<void> {
|
||||
const booking = await prisma.booking.findUnique({
|
||||
where: {
|
||||
uid: bookingUid,
|
||||
status: BookingStatus.ACCEPTED,
|
||||
},
|
||||
include: {
|
||||
user: {
|
||||
@@ -52,6 +51,11 @@ export async function createCRMEvent(payload: string): Promise<void> {
|
||||
throw new Error(`booking not found for uid: ${bookingUid}`);
|
||||
}
|
||||
|
||||
if (booking.status !== BookingStatus.ACCEPTED) {
|
||||
log.info(`Booking status is not ACCEPTED`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!booking.user) {
|
||||
throw new Error(`user not found for uid: ${bookingUid}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user