From c004a940e03f90b3d4b4edb34692d0e98b5b07cb Mon Sep 17 00:00:00 2001 From: "Dr. Alwin Simon" <003alwin@gmail.com> Date: Sat, 28 Oct 2023 00:17:18 +0530 Subject: [PATCH] Modified API response to return tickets that are available to book (unreserved Tickets). --- tickets/src/routes/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tickets/src/routes/index.ts b/tickets/src/routes/index.ts index 600d265..525b07b 100644 --- a/tickets/src/routes/index.ts +++ b/tickets/src/routes/index.ts @@ -4,7 +4,9 @@ import { Ticket } from "../models/ticket"; const router = express.Router(); router.get("/api/tickets", async (req: Request, res: Response) => { - const tickets = await Ticket.find({}); + + // Fetch all Tickets that are available to make a booking (ie, which are not reserved by any order) + const tickets = await Ticket.find({orderId: undefined}); res.send(tickets); });