rental request email to owner

This commit is contained in:
jackiettran
2025-10-15 15:19:23 -04:00
parent b9e6cfc54d
commit 407c69aa22
9 changed files with 658 additions and 56 deletions

View File

@@ -284,6 +284,24 @@ router.post("/", authenticateToken, requireVerifiedEmail, async (req, res) => {
],
});
// Send rental request notification to owner
try {
await emailService.sendRentalRequestEmail(rentalWithDetails);
const reqLogger = logger.withRequestId(req.id);
reqLogger.info("Rental request notification sent to owner", {
rentalId: rental.id,
ownerId: rentalWithDetails.ownerId,
});
} catch (emailError) {
// Log error but don't fail the request
const reqLogger = logger.withRequestId(req.id);
reqLogger.error("Failed to send rental request email", {
error: emailError.message,
rentalId: rental.id,
ownerId: rentalWithDetails.ownerId,
});
}
res.status(201).json(rentalWithDetails);
} catch (error) {
res.status(500).json({ error: "Failed to create rental" });