email refactor

This commit is contained in:
jackiettran
2025-11-14 17:36:35 -05:00
parent 629f0055a1
commit 3a6da3d47d
25 changed files with 3176 additions and 2219 deletions

View File

@@ -1,5 +1,5 @@
const { Rental, Item } = require("../models");
const emailService = require("./emailService");
const { Rental, Item, User } = require("../models");
const emailServices = require("./email");
class LateReturnService {
/**
@@ -91,8 +91,14 @@ class LateReturnService {
// Send notification to customer service if late return detected
if (lateCalculation.isLate && lateCalculation.lateFee > 0) {
await emailService.sendLateReturnToCustomerService(
// Fetch owner and renter user data for email
const owner = await User.findByPk(updatedRental.ownerId);
const renter = await User.findByPk(updatedRental.renterId);
await emailServices.customerService.sendLateReturnToCustomerService(
updatedRental,
owner,
renter,
lateCalculation
);
}