From 0104f369a9a42198be6fe00723a34935223be06e Mon Sep 17 00:00:00 2001 From: jackiettran <41605212+jackiettran@users.noreply.github.com> Date: Thu, 1 Jan 2026 23:49:03 -0500 Subject: [PATCH] Owner should only be able to complete an active rental not a confirmed rental. Removed an icon --- backend/routes/rentals.js | 8 ++++---- .../src/components/ConditionCheckModal.tsx | 14 +++++++------ frontend/src/pages/Owning.tsx | 20 ++++++------------- 3 files changed, 18 insertions(+), 24 deletions(-) diff --git a/backend/routes/rentals.js b/backend/routes/rentals.js index 862c9dd..c26ab1b 100644 --- a/backend/routes/rentals.js +++ b/backend/routes/rentals.js @@ -875,9 +875,9 @@ router.post("/:id/mark-completed", authenticateToken, async (req, res) => { .json({ error: "Only owners can mark rentals as completed" }); } - if (!["active", "confirmed"].includes(rental.status)) { + if (rental.status !== "active") { return res.status(400).json({ - error: "Can only mark active or confirmed rentals as completed", + error: "Can only mark active rentals as completed", }); } @@ -1197,9 +1197,9 @@ router.post("/:id/mark-return", authenticateToken, async (req, res, next) => { .json({ error: "Only the item owner can mark return status" }); } - if (!["confirmed", "active"].includes(rental.status)) { + if (rental.status !== "active") { return res.status(400).json({ - error: "Can only mark return status for confirmed or active rentals", + error: "Can only mark return status for active rentals", }); } diff --git a/frontend/src/components/ConditionCheckModal.tsx b/frontend/src/components/ConditionCheckModal.tsx index f22e6f8..30a430e 100644 --- a/frontend/src/components/ConditionCheckModal.tsx +++ b/frontend/src/components/ConditionCheckModal.tsx @@ -85,7 +85,10 @@ const ConditionCheckModal: React.FC = ({ setError(null); // Upload photos to S3 first (with resizing) - const uploadResults = await uploadImagesWithVariants("condition-check", photos); + const uploadResults = await uploadImagesWithVariants( + "condition-check", + photos + ); const imageFilenames = uploadResults.map((result) => result.baseKey); // Submit condition check with S3 keys @@ -154,7 +157,9 @@ const ConditionCheckModal: React.FC = ({
= ({ Submitting... ) : ( - <> - - Submit Condition Check - + <>Submit Condition Check )}
diff --git a/frontend/src/pages/Owning.tsx b/frontend/src/pages/Owning.tsx index ff154c1..08b9f32 100644 --- a/frontend/src/pages/Owning.tsx +++ b/frontend/src/pages/Owning.tsx @@ -513,20 +513,12 @@ const Owning: React.FC = () => { )} {rental.status === "confirmed" && ( - <> - - - + )} {rental.status === "active" && (