use nodemailer instead of sendgrid

This commit is contained in:
Thomas Ruoff
2022-12-22 23:00:44 +01:00
parent e0fe762c80
commit 28b3b03279
5 changed files with 130 additions and 211 deletions

View File

@@ -63,12 +63,16 @@ export default async function userHandler(
const { current, previous } = await patchBooking(uuid, req.body)
// TODO: this should really go into the schema
if (wasRejected(previous, current)) {
sendBookingRejected(current)
} else if (wasConfirmed(previous, current)) {
sendBookingConfirmed(current)
} else if (wasCanceled(previous, current)) {
sendBookingCanceled(current)
try {
if (wasRejected(previous, current)) {
sendBookingRejected(current)
} else if (wasConfirmed(previous, current)) {
sendBookingConfirmed(current)
} else if (wasCanceled(previous, current)) {
sendBookingCanceled(current)
}
} catch (error) {
log.error(`Failed to send booking ${current} for booking ${uuid}`)
}
res.status(200).json(current)
@@ -81,4 +85,4 @@ export default async function userHandler(
res.setHeader('Allow', ['PATCH'])
res.status(405).end(`Method ${method} Not Allowed`)
}
}
}