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
This commit is contained in:
michaelschal committed 2025-09-02 08:31:06 +00:00
1 parent 7cdbdfff68
commit ad7bd07670
1 file changed
+9 -1
+9 -1
View File
@@ -211,8 +211,16 @@ export async function registerRoutes(app: Express): Promise<Server> {
}
// 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" });