From 622f4b20f2bb917129637c1aa7d9004807f06bcb Mon Sep 17 00:00:00 2001 From: Tom Butcher Date: Sun, 13 Sep 2026 17:21:25 +0100 Subject: [PATCH] Add delete route handlers for GCode files and printers This commit introduces new route handlers for deleting GCode files and printers, enhancing the application's data management capabilities. The `deleteGCodeFileRouteHandler` and `deletePrinterRouteHandler` are added, allowing for individual deletion of these entities. Additionally, the necessary authentication and permission checks are implemented for these routes, ensuring secure access control. --- src/routes/production/gcodefiles.js | 7 ++++++- src/routes/production/printers.js | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/routes/production/gcodefiles.js b/src/routes/production/gcodefiles.js index 5798452..b94dfc4 100644 --- a/src/routes/production/gcodefiles.js +++ b/src/routes/production/gcodefiles.js @@ -29,7 +29,8 @@ import { getGCodeFilePropertyValuesRouteHandler, getGCodeFileNeighborsRouteHandler, - deleteGCodeFileByFilterRouteHandler + deleteGCodeFileByFilterRouteHandler, + deleteGCodeFileRouteHandler } from '../../services/production/gcodefiles.js'; import { convertPropertiesString, getFilter, getSort } from '../../utils.js'; @@ -122,4 +123,8 @@ router.put('/:id', isAuthenticated, checkPermissions('gcodeFile', 'edit'), async editGCodeFileRouteHandler(req, res); }); +router.delete('/:id', isAuthenticated, checkPermissions('gcodeFile', 'delete'), async (req, res) => { + deleteGCodeFileRouteHandler(req, res); +}); + export default router; diff --git a/src/routes/production/printers.js b/src/routes/production/printers.js index 419c3e8..fc89177 100644 --- a/src/routes/production/printers.js +++ b/src/routes/production/printers.js @@ -15,6 +15,7 @@ import { getPrinterPropertyValuesRouteHandler, getPrinterNeighborsRouteHandler, deletePrinterByFilterRouteHandler, + deletePrinterRouteHandler, } from '../../services/production/printers.js'; import { convertPropertiesString, getFilter, getSort } from '../../utils.js'; @@ -122,4 +123,8 @@ router.put('/:id', isAuthenticated, checkPermissions('printer', 'edit'), async ( editPrinterRouteHandler(req, res); }); +router.delete('/:id', isAuthenticated, checkPermissions('printer', 'delete'), async (req, res) => { + deletePrinterRouteHandler(req, res); +}); + export default router;