feat: add option to provide cancellation reason for email (#1587)

* feat: add option to provide cancellation reason for email

* chore: move pos of getCancellationReason method in classes

* fix: only show cancellation reason if given
This commit is contained in:
Nikolay Rademacher authored and GitHub committed 2022-01-28 10:40:29 -07:00
1 parent 8d0861809c
commit 07b75dadbd
9 files changed
+85 -41

No files matched your search

+3
View File
@@ -25,6 +25,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
}
const uid = asStringOrNull(req.body.uid) || "";
const cancellationReason = asStringOrNull(req.body.reason) || "";
const session = await getSession({ req: req });
const bookingToDelete = await prisma.booking.findUnique({
@@ -125,6 +126,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
uid: bookingToDelete?.uid,
location: bookingToDelete?.location,
destinationCalendar: bookingToDelete?.destinationCalendar || bookingToDelete?.user.destinationCalendar,
cancellationReason: cancellationReason,
};
// Hook up the webhook logic here
@@ -148,6 +150,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
},
data: {
status: BookingStatus.CANCELLED,
cancellationReason: cancellationReason,
},
});