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:
1 parent
8d0861809c
commit
07b75dadbd
9 files changed
+85
-41
No files matched your search
@@ -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,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user