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,6 +1,7 @@
|
||||
const { Rental, Item, ConditionCheck, User } = require("../models");
|
||||
const LateReturnService = require("./lateReturnService");
|
||||
const emailServices = require("./email");
|
||||
const { isActive } = require("../utils/rentalStatus");
|
||||
|
||||
class DamageAssessmentService {
|
||||
/**
|
||||
@@ -34,7 +35,7 @@ class DamageAssessmentService {
|
||||
throw new Error("Only the item owner can report damage");
|
||||
}
|
||||
|
||||
if (rental.status !== "active") {
|
||||
if (!isActive(rental)) {
|
||||
throw new Error("Can only assess damage for active rentals");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user