Updated allowedFilters in printers.js to include '_id' and '_reference' for enhanced filtering capabilities in printer queries. Cleaned up unnecessary whitespace in the file.

This commit is contained in:
Tom Butcher 2026-08-01 12:41:29 +01:00
parent 3155733642
commit 7a1b85bb19

View File

@ -11,14 +11,14 @@ import {
listPrintersByPropertiesRouteHandler, listPrintersByPropertiesRouteHandler,
getPrinterHistoryRouteHandler, getPrinterHistoryRouteHandler,
searchPrintersRouteHandler, searchPrintersRouteHandler,
getPrinterPropertyValuesRouteHandler getPrinterPropertyValuesRouteHandler,
} from '../../services/production/printers.js'; } from '../../services/production/printers.js';
import { convertPropertiesString, getFilter } from '../../utils.js'; import { convertPropertiesString, getFilter } from '../../utils.js';
// list of printers // list of printers
router.get('/', isAuthenticated, (req, res) => { router.get('/', isAuthenticated, (req, res) => {
const { page, limit, property, search, sort, order } = req.query; const { page, limit, property, search, sort, order } = req.query;
const allowedFilters = ['tags', 'host._id', 'active', 'online', 'name']; const allowedFilters = ['tags', 'host._id', 'active', 'online', 'name', '_id', '_reference'];
const filter = getFilter(req.query, allowedFilters); const filter = getFilter(req.query, allowedFilters);
listPrintersRouteHandler(req, res, page, limit, property, filter, search, sort, order); listPrintersRouteHandler(req, res, page, limit, property, filter, search, sort, order);
}); });
@ -43,7 +43,6 @@ router.get('/search', isAuthenticated, (req, res) => {
searchPrintersRouteHandler(req, res, search); searchPrintersRouteHandler(req, res, search);
}); });
// create new printer // create new printer
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newPrinterRouteHandler(req, res); newPrinterRouteHandler(req, res);