From ad7bd0767001b4fc5b542ec0c7f0e6e080efa094 Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Tue, 2 Sep 2025 08:31:06 +0000 Subject: [PATCH] Improve filtering for suppliers based on DLC status Correctly filter suppliers to only show DLC-enabled ones when the DLC filter is applied in the API. Replit-Commit-Author: Agent Replit-Commit-Session-Id: f2b9c241-9fdd-4abd-9041-720afc8b27d6 Replit-Commit-Checkpoint-Type: full_checkpoint --- server/routes.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/server/routes.ts b/server/routes.ts index 7c6a70d..f4fc60c 100644 --- a/server/routes.ts +++ b/server/routes.ts @@ -211,8 +211,16 @@ export async function registerRoutes(app: Express): Promise { } // Check if DLC filter is requested + const dlcFilter = req.query.dlc === 'true'; const suppliers = await storage.getSuppliers(); - res.json(suppliers); + + // Filter suppliers for DLC enabled only if requested + if (dlcFilter) { + const dlcSuppliers = suppliers.filter(supplier => supplier.dlcEnabled === true); + res.json(dlcSuppliers); + } else { + res.json(suppliers); + } } catch (error) { console.error("Error fetching suppliers:", error); res.status(500).json({ message: "Failed to fetch suppliers" });