Handle cancelled status (#19272)

This commit is contained in:
Joe Au-Yeung
2025-02-13 12:59:41 +05:30
committed by GitHub
parent 46add2bebc
commit 6364e85293
@@ -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}`);
}