Enhance allowedFilters in printers.js and subjobs.js to include 'state' and '_reference' for improved filtering capabilities. Cleaned up whitespace for better code readability.
All checks were successful
farmcontrol/farmcontrol-api/pipeline/head This commit looks good
All checks were successful
farmcontrol/farmcontrol-api/pipeline/head This commit looks good
This commit is contained in:
parent
664a3a4884
commit
c233be5d80
@ -16,7 +16,16 @@ import {
|
||||
} from '../../services/production/printers.js';
|
||||
import { convertPropertiesString, getFilter } from '../../utils.js';
|
||||
|
||||
const listAllowedFilters = ['tags', 'host._id', 'active', 'online', 'name', '_id', '_reference'];
|
||||
const listAllowedFilters = [
|
||||
'tags',
|
||||
'host._id',
|
||||
'active',
|
||||
'online',
|
||||
'name',
|
||||
'_id',
|
||||
'_reference',
|
||||
'state',
|
||||
];
|
||||
const propertiesAllowedFilters = ['tags'];
|
||||
// list of printers
|
||||
router.get('/', isAuthenticated, (req, res) => {
|
||||
|
||||
@ -3,7 +3,7 @@ import { isAuthenticated } from '../../keycloak.js';
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
const listAllowedFilters = ['_id', 'job._id', 'printer._id'];
|
||||
const listAllowedFilters = ['_id', 'job._id', 'printer._id', '_reference', 'state'];
|
||||
const propertiesAllowedFilters = ['job'];
|
||||
import {
|
||||
listSubJobsRouteHandler,
|
||||
@ -13,15 +13,14 @@ import {
|
||||
getSubJobHistoryRouteHandler,
|
||||
searchSubJobsRouteHandler,
|
||||
getSubJobPropertyValuesRouteHandler,
|
||||
|
||||
getSubJobNeighborsRouteHandler
|
||||
getSubJobNeighborsRouteHandler,
|
||||
} from '../../services/production/subjobs.js';
|
||||
import { getFilter, convertPropertiesString } from '../../utils.js';
|
||||
|
||||
// list of sub jobs
|
||||
router.get('/', isAuthenticated, (req, res) => {
|
||||
const { page, limit, property, search, sort, order } = req.query;
|
||||
const filter = getFilter(req.query, listAllowedFilters);
|
||||
const filter = getFilter(req.query, listAllowedFilters);
|
||||
listSubJobsRouteHandler(req, res, page, limit, property, filter, search, sort, order);
|
||||
});
|
||||
|
||||
@ -44,7 +43,6 @@ router.get('/search', isAuthenticated, (req, res) => {
|
||||
searchSubJobsRouteHandler(req, res, search);
|
||||
});
|
||||
|
||||
|
||||
// get sub job stats
|
||||
router.get('/stats', isAuthenticated, (req, res) => {
|
||||
getSubJobStatsRouteHandler(req, res);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user