schema updates to rental statuses

This commit is contained in:
jackiettran
2025-11-24 18:08:12 -05:00
parent 42a5412582
commit 8e6af92cba
7 changed files with 19 additions and 34 deletions

View File

@@ -823,7 +823,7 @@ router.post("/:id/mark-completed", authenticateToken, async (req, res) => {
});
}
await rental.update({ status: "completed" });
await rental.update({ status: "completed", payoutStatus: "pending" });
const updatedRental = await Rental.findByPk(rental.id, {
include: [
@@ -1131,6 +1131,7 @@ router.post("/:id/mark-return", authenticateToken, async (req, res) => {
// Item returned on time
updatedRental = await rental.update({
status: "completed",
payoutStatus: "pending",
actualReturnDateTime: actualReturnDateTime || rental.endDateTime,
notes: notes || null,
});
@@ -1174,6 +1175,7 @@ router.post("/:id/mark-return", authenticateToken, async (req, res) => {
// Item returned damaged
const damageUpdates = {
status: "damaged",
payoutStatus: "pending",
actualReturnDateTime: actualReturnDateTime || rental.endDateTime,
notes: notes || null,
};
@@ -1217,6 +1219,7 @@ router.post("/:id/mark-return", authenticateToken, async (req, res) => {
// Item reported as lost
updatedRental = await rental.update({
status: "lost",
payoutStatus: "pending",
itemLostReportedAt: new Date(),
notes: notes || null,
});