email refactor
This commit is contained in:
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user