diff --git a/backend/models/Item.js b/backend/models/Item.js
index 103dc7f..8ad8c7b 100644
--- a/backend/models/Item.js
+++ b/backend/models/Item.js
@@ -13,7 +13,7 @@ const Item = sequelize.define("Item", {
},
description: {
type: DataTypes.TEXT,
- allowNull: false,
+ allowNull: true,
},
pickUpAvailable: {
type: DataTypes.BOOLEAN,
diff --git a/backend/routes/maps.js b/backend/routes/maps.js
index 65d526c..f29b381 100644
--- a/backend/routes/maps.js
+++ b/backend/routes/maps.js
@@ -113,7 +113,6 @@ router.post(
router.post(
"/places/details",
authenticateToken,
- rateLimiter.burstProtection,
rateLimiter.placeDetails,
validateInput,
async (req, res) => {
diff --git a/backend/routes/rentals.js b/backend/routes/rentals.js
index c67f39b..0cb6d01 100644
--- a/backend/routes/rentals.js
+++ b/backend/routes/rentals.js
@@ -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" });
diff --git a/backend/services/emailService.js b/backend/services/emailService.js
index 1f69762..13b0411 100644
--- a/backend/services/emailService.js
+++ b/backend/services/emailService.js
@@ -41,6 +41,7 @@ class EmailService {
"lateReturnCS.html",
"damageReportCS.html",
"lostItemCS.html",
+ "rentalRequest.html",
];
for (const templateFile of templateFiles) {
@@ -65,38 +66,40 @@ class EmailService {
* Strips HTML tags and formats content for plain text email clients
*/
htmlToPlainText(html) {
- return html
- // Remove style and script tags and their content
- .replace(/
+
+
+
+
+
+
+
Hi {{ownerName}},
+
+
You have a new rental request!
+
+
+ {{renterName}} would like to rent your {{itemName}}.
+
+
+
+
You'll earn: ${{payoutAmount}}
+
+
+
Request Details
+
+
+ | Renter |
+ {{renterName}} |
+
+
+ | Item |
+ {{itemName}} |
+
+
+ | Start Date |
+ {{startDate}} |
+
+
+ | End Date |
+ {{endDate}} |
+
+
+ | Delivery Method |
+ {{deliveryMethod}} |
+
+
+ | Total Amount |
+ ${{totalAmount}} |
+
+
+ | Your Earnings |
+ ${{payoutAmount}} |
+
+
+
+
+
Renter's Notes:
+
{{rentalNotes}}
+
+
+
+
+
What happens next?
+
+ - Review the rental request and renter's profile
+ - Approve or decline the request within 24 hours
+ - If approved, payment will be processed automatically
+ - Communicate with the renter about pickup/delivery details
+
+
+
+ Important reminder: Please respond to rental requests
+ promptly. Quick responses help build trust and improve your listing's
+ visibility.
+
+
+
+
+
+
+