removed cron job that made rentals active. Now whether or not the rental is active is determined on the fly
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
const { Rental, Item, User } = require("../models");
|
||||
const emailServices = require("./email");
|
||||
const { isActive } = require("../utils/rentalStatus");
|
||||
|
||||
class LateReturnService {
|
||||
/**
|
||||
@@ -71,7 +72,7 @@ class LateReturnService {
|
||||
throw new Error("Rental not found");
|
||||
}
|
||||
|
||||
if (rental.status !== "active") {
|
||||
if (!isActive(rental)) {
|
||||
throw new Error("Can only process late returns for active rentals");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user