Compare commits
2 Commits
a42f953e9a
...
3dd80b7790
| Author | SHA1 | Date | |
|---|---|---|---|
| 3dd80b7790 | |||
| 11ff82a9af |
@ -27,7 +27,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
|
|||||||
let properties = convertPropertiesString(req.query.properties);
|
let properties = convertPropertiesString(req.query.properties);
|
||||||
const allowedFilters = ['taxRate', 'transactionType', 'transaction'];
|
const allowedFilters = ['taxRate', 'transactionType', 'transaction'];
|
||||||
const filter = getFilter(req.query, allowedFilters, false);
|
const filter = getFilter(req.query, allowedFilters, false);
|
||||||
listTaxRecordsByPropertiesRouteHandler(req, res, properties, filter);
|
var masterFilter = {};
|
||||||
|
if (req.query.masterFilter) {
|
||||||
|
masterFilter = JSON.parse(req.query.masterFilter);
|
||||||
|
}
|
||||||
|
listTaxRecordsByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||||
});
|
});
|
||||||
router.get('/search', isAuthenticated, (req, res) => {
|
router.get('/search', isAuthenticated, (req, res) => {
|
||||||
const { search } = req.query;
|
const { search } = req.query;
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import {
|
|||||||
listCouriersByPropertiesRouteHandler,
|
listCouriersByPropertiesRouteHandler,
|
||||||
getCourierStatsRouteHandler,
|
getCourierStatsRouteHandler,
|
||||||
getCourierHistoryRouteHandler,
|
getCourierHistoryRouteHandler,
|
||||||
searchCouriersRouteHandler
|
searchCouriersRouteHandler,
|
||||||
} from '../../services/management/courier.js';
|
} from '../../services/management/courier.js';
|
||||||
|
|
||||||
// list of couriers
|
// list of couriers
|
||||||
@ -27,14 +27,18 @@ router.get('/properties', isAuthenticated, (req, res) => {
|
|||||||
let properties = convertPropertiesString(req.query.properties);
|
let properties = convertPropertiesString(req.query.properties);
|
||||||
const allowedFilters = ['name', 'website', 'email', 'phone', 'contact', 'country'];
|
const allowedFilters = ['name', 'website', 'email', 'phone', 'contact', 'country'];
|
||||||
const filter = getFilter(req.query, allowedFilters, false);
|
const filter = getFilter(req.query, allowedFilters, false);
|
||||||
listCouriersByPropertiesRouteHandler(req, res, properties, filter);
|
var masterFilter = {};
|
||||||
|
if (req.query.masterFilter) {
|
||||||
|
masterFilter = JSON.parse(req.query.masterFilter);
|
||||||
|
}
|
||||||
|
listCouriersByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/search', isAuthenticated, (req, res) => {
|
router.get('/search', isAuthenticated, (req, res) => {
|
||||||
const { search } = req.query;
|
const { search } = req.query;
|
||||||
searchCouriersRouteHandler(req, res, search);
|
searchCouriersRouteHandler(req, res, search);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
router.post('/', isAuthenticated, (req, res) => {
|
router.post('/', isAuthenticated, (req, res) => {
|
||||||
newCourierRouteHandler(req, res);
|
newCourierRouteHandler(req, res);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -47,8 +47,13 @@ router.get('/properties', isAuthenticated, (req, res) => {
|
|||||||
'costWithTax',
|
'costWithTax',
|
||||||
];
|
];
|
||||||
const filter = getFilter(req.query, allowedFilters, false);
|
const filter = getFilter(req.query, allowedFilters, false);
|
||||||
listCourierServicesByPropertiesRouteHandler(req, res, properties, filter);
|
var masterFilter = {};
|
||||||
|
if (req.query.masterFilter) {
|
||||||
|
masterFilter = JSON.parse(req.query.masterFilter);
|
||||||
|
}
|
||||||
|
listCourierServicesByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/search', isAuthenticated, (req, res) => {
|
router.get('/search', isAuthenticated, (req, res) => {
|
||||||
const { search } = req.query;
|
const { search } = req.query;
|
||||||
searchCourierServicesRouteHandler(req, res, search);
|
searchCourierServicesRouteHandler(req, res, search);
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import {
|
|||||||
listDocumentJobsByPropertiesRouteHandler,
|
listDocumentJobsByPropertiesRouteHandler,
|
||||||
getDocumentJobStatsRouteHandler,
|
getDocumentJobStatsRouteHandler,
|
||||||
getDocumentJobHistoryRouteHandler,
|
getDocumentJobHistoryRouteHandler,
|
||||||
searchDocumentJobsRouteHandler
|
searchDocumentJobsRouteHandler,
|
||||||
} from '../../services/management/documentjobs.js';
|
} from '../../services/management/documentjobs.js';
|
||||||
|
|
||||||
// list of document jobs
|
// list of document jobs
|
||||||
@ -27,14 +27,18 @@ router.get('/properties', isAuthenticated, (req, res) => {
|
|||||||
let properties = convertPropertiesString(req.query.properties);
|
let properties = convertPropertiesString(req.query.properties);
|
||||||
const allowedFilters = [];
|
const allowedFilters = [];
|
||||||
const filter = getFilter(req.query, allowedFilters, false);
|
const filter = getFilter(req.query, allowedFilters, false);
|
||||||
listDocumentJobsByPropertiesRouteHandler(req, res, properties, filter);
|
var masterFilter = {};
|
||||||
|
if (req.query.masterFilter) {
|
||||||
|
masterFilter = JSON.parse(req.query.masterFilter);
|
||||||
|
}
|
||||||
|
listDocumentJobsByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/search', isAuthenticated, (req, res) => {
|
router.get('/search', isAuthenticated, (req, res) => {
|
||||||
const { search } = req.query;
|
const { search } = req.query;
|
||||||
searchDocumentJobsRouteHandler(req, res, search);
|
searchDocumentJobsRouteHandler(req, res, search);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
router.post('/', isAuthenticated, (req, res) => {
|
router.post('/', isAuthenticated, (req, res) => {
|
||||||
newDocumentJobRouteHandler(req, res);
|
newDocumentJobRouteHandler(req, res);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import {
|
|||||||
listDocumentPrintersByPropertiesRouteHandler,
|
listDocumentPrintersByPropertiesRouteHandler,
|
||||||
getDocumentPrinterStatsRouteHandler,
|
getDocumentPrinterStatsRouteHandler,
|
||||||
getDocumentPrinterHistoryRouteHandler,
|
getDocumentPrinterHistoryRouteHandler,
|
||||||
searchDocumentPrintersRouteHandler
|
searchDocumentPrintersRouteHandler,
|
||||||
} from '../../services/management/documentprinters.js';
|
} from '../../services/management/documentprinters.js';
|
||||||
|
|
||||||
// list of document printers
|
// list of document printers
|
||||||
@ -27,14 +27,18 @@ router.get('/properties', isAuthenticated, (req, res) => {
|
|||||||
let properties = convertPropertiesString(req.query.properties);
|
let properties = convertPropertiesString(req.query.properties);
|
||||||
const allowedFilters = ['tags'];
|
const allowedFilters = ['tags'];
|
||||||
const filter = getFilter(req.query, allowedFilters, false);
|
const filter = getFilter(req.query, allowedFilters, false);
|
||||||
listDocumentPrintersByPropertiesRouteHandler(req, res, properties, filter);
|
var masterFilter = {};
|
||||||
|
if (req.query.masterFilter) {
|
||||||
|
masterFilter = JSON.parse(req.query.masterFilter);
|
||||||
|
}
|
||||||
|
listDocumentPrintersByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/search', isAuthenticated, (req, res) => {
|
router.get('/search', isAuthenticated, (req, res) => {
|
||||||
const { search } = req.query;
|
const { search } = req.query;
|
||||||
searchDocumentPrintersRouteHandler(req, res, search);
|
searchDocumentPrintersRouteHandler(req, res, search);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
router.post('/', isAuthenticated, (req, res) => {
|
router.post('/', isAuthenticated, (req, res) => {
|
||||||
newDocumentPrinterRouteHandler(req, res);
|
newDocumentPrinterRouteHandler(req, res);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import {
|
|||||||
listDocumentSizesByPropertiesRouteHandler,
|
listDocumentSizesByPropertiesRouteHandler,
|
||||||
getDocumentSizeStatsRouteHandler,
|
getDocumentSizeStatsRouteHandler,
|
||||||
getDocumentSizeHistoryRouteHandler,
|
getDocumentSizeHistoryRouteHandler,
|
||||||
searchDocumentSizesRouteHandler
|
searchDocumentSizesRouteHandler,
|
||||||
} from '../../services/management/documentsizes.js';
|
} from '../../services/management/documentsizes.js';
|
||||||
|
|
||||||
// list of document sizes
|
// list of document sizes
|
||||||
@ -27,14 +27,18 @@ router.get('/properties', isAuthenticated, (req, res) => {
|
|||||||
let properties = convertPropertiesString(req.query.properties);
|
let properties = convertPropertiesString(req.query.properties);
|
||||||
const allowedFilters = [];
|
const allowedFilters = [];
|
||||||
const filter = getFilter(req.query, allowedFilters, false);
|
const filter = getFilter(req.query, allowedFilters, false);
|
||||||
listDocumentSizesByPropertiesRouteHandler(req, res, properties, filter);
|
var masterFilter = {};
|
||||||
|
if (req.query.masterFilter) {
|
||||||
|
masterFilter = JSON.parse(req.query.masterFilter);
|
||||||
|
}
|
||||||
|
listDocumentSizesByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/search', isAuthenticated, (req, res) => {
|
router.get('/search', isAuthenticated, (req, res) => {
|
||||||
const { search } = req.query;
|
const { search } = req.query;
|
||||||
searchDocumentSizesRouteHandler(req, res, search);
|
searchDocumentSizesRouteHandler(req, res, search);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
router.post('/', isAuthenticated, (req, res) => {
|
router.post('/', isAuthenticated, (req, res) => {
|
||||||
newDocumentSizeRouteHandler(req, res);
|
newDocumentSizeRouteHandler(req, res);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -13,21 +13,14 @@ import {
|
|||||||
deleteFilamentRouteHandler,
|
deleteFilamentRouteHandler,
|
||||||
getFilamentStatsRouteHandler,
|
getFilamentStatsRouteHandler,
|
||||||
getFilamentHistoryRouteHandler,
|
getFilamentHistoryRouteHandler,
|
||||||
searchFilamentsRouteHandler
|
searchFilamentsRouteHandler,
|
||||||
} from '../../services/management/filaments.js';
|
} from '../../services/management/filaments.js';
|
||||||
|
|
||||||
// list of filaments
|
// list of filaments
|
||||||
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 = [
|
const allowedFilters = ['_id', 'material', 'material._id', 'diameter', 'name', 'cost'];
|
||||||
'_id',
|
|
||||||
'material',
|
|
||||||
'material._id',
|
|
||||||
'diameter',
|
|
||||||
'name',
|
|
||||||
'cost',
|
|
||||||
];
|
|
||||||
|
|
||||||
var filter = {};
|
var filter = {};
|
||||||
|
|
||||||
@ -46,14 +39,18 @@ router.get('/properties', isAuthenticated, (req, res) => {
|
|||||||
let properties = convertPropertiesString(req.query.properties);
|
let properties = convertPropertiesString(req.query.properties);
|
||||||
const allowedFilters = ['diameter', 'material'];
|
const allowedFilters = ['diameter', 'material'];
|
||||||
const filter = getFilter(req.query, allowedFilters, false);
|
const filter = getFilter(req.query, allowedFilters, false);
|
||||||
listFilamentsByPropertiesRouteHandler(req, res, properties, filter);
|
var masterFilter = {};
|
||||||
|
if (req.query.masterFilter) {
|
||||||
|
masterFilter = JSON.parse(req.query.masterFilter);
|
||||||
|
}
|
||||||
|
listFilamentsByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/search', isAuthenticated, (req, res) => {
|
router.get('/search', isAuthenticated, (req, res) => {
|
||||||
const { search } = req.query;
|
const { search } = req.query;
|
||||||
searchFilamentsRouteHandler(req, res, search);
|
searchFilamentsRouteHandler(req, res, search);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
router.post('/', isAuthenticated, (req, res) => {
|
router.post('/', isAuthenticated, (req, res) => {
|
||||||
newFilamentRouteHandler(req, res);
|
newFilamentRouteHandler(req, res);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -14,29 +14,33 @@ import {
|
|||||||
listFilesByPropertiesRouteHandler,
|
listFilesByPropertiesRouteHandler,
|
||||||
getFileStatsRouteHandler,
|
getFileStatsRouteHandler,
|
||||||
getFileHistoryRouteHandler,
|
getFileHistoryRouteHandler,
|
||||||
searchFilesRouteHandler
|
searchFilesRouteHandler,
|
||||||
} from '../../services/management/files.js';
|
} from '../../services/management/files.js';
|
||||||
|
|
||||||
// list of files
|
// list of files
|
||||||
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 = ['_id', 'name', 'type', 'size'];
|
const allowedFilters = ['_id', 'name', 'type', 'size', 'extension'];
|
||||||
const filter = getFilter(req.query, allowedFilters);
|
const filter = getFilter(req.query, allowedFilters);
|
||||||
listFilesRouteHandler(req, res, page, limit, property, filter, search, sort, order);
|
listFilesRouteHandler(req, res, page, limit, property, filter, search, sort, order);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/properties', isAuthenticated, (req, res) => {
|
router.get('/properties', isAuthenticated, (req, res) => {
|
||||||
let properties = convertPropertiesString(req.query.properties);
|
let properties = convertPropertiesString(req.query.properties);
|
||||||
const allowedFilters = ['type'];
|
const allowedFilters = ['type', 'extension'];
|
||||||
const filter = getFilter(req.query, allowedFilters, false);
|
const filter = getFilter(req.query, allowedFilters, false);
|
||||||
listFilesByPropertiesRouteHandler(req, res, properties, filter);
|
var masterFilter = {};
|
||||||
|
if (req.query.masterFilter) {
|
||||||
|
masterFilter = JSON.parse(req.query.masterFilter);
|
||||||
|
}
|
||||||
|
listFilesByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/search', isAuthenticated, (req, res) => {
|
router.get('/search', isAuthenticated, (req, res) => {
|
||||||
const { search } = req.query;
|
const { search } = req.query;
|
||||||
searchFilesRouteHandler(req, res, search);
|
searchFilesRouteHandler(req, res, search);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
router.post('/', isAuthenticated, (req, res) => {
|
router.post('/', isAuthenticated, (req, res) => {
|
||||||
newFileRouteHandler(req, res);
|
newFileRouteHandler(req, res);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import {
|
|||||||
listHostsByPropertiesRouteHandler,
|
listHostsByPropertiesRouteHandler,
|
||||||
getHostStatsRouteHandler,
|
getHostStatsRouteHandler,
|
||||||
getHostHistoryRouteHandler,
|
getHostHistoryRouteHandler,
|
||||||
searchHostsRouteHandler
|
searchHostsRouteHandler,
|
||||||
} from '../../services/management/hosts.js';
|
} from '../../services/management/hosts.js';
|
||||||
|
|
||||||
// list of hosts
|
// list of hosts
|
||||||
@ -27,14 +27,18 @@ router.get('/properties', isAuthenticated, (req, res) => {
|
|||||||
let properties = convertPropertiesString(req.query.properties);
|
let properties = convertPropertiesString(req.query.properties);
|
||||||
const allowedFilters = ['tags'];
|
const allowedFilters = ['tags'];
|
||||||
const filter = getFilter(req.query, allowedFilters, false);
|
const filter = getFilter(req.query, allowedFilters, false);
|
||||||
listHostsByPropertiesRouteHandler(req, res, properties, filter);
|
var masterFilter = {};
|
||||||
|
if (req.query.masterFilter) {
|
||||||
|
masterFilter = JSON.parse(req.query.masterFilter);
|
||||||
|
}
|
||||||
|
listHostsByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/search', isAuthenticated, (req, res) => {
|
router.get('/search', isAuthenticated, (req, res) => {
|
||||||
const { search } = req.query;
|
const { search } = req.query;
|
||||||
searchHostsRouteHandler(req, res, search);
|
searchHostsRouteHandler(req, res, search);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
router.post('/', isAuthenticated, (req, res) => {
|
router.post('/', isAuthenticated, (req, res) => {
|
||||||
newHostRouteHandler(req, res);
|
newHostRouteHandler(req, res);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -35,7 +35,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
|
|||||||
let properties = convertPropertiesString(req.query.properties);
|
let properties = convertPropertiesString(req.query.properties);
|
||||||
const allowedFilters = ['name', 'tags'];
|
const allowedFilters = ['name', 'tags'];
|
||||||
const filter = getFilter(req.query, allowedFilters, false);
|
const filter = getFilter(req.query, allowedFilters, false);
|
||||||
listMaterialsByPropertiesRouteHandler(req, res, properties, filter);
|
var masterFilter = {};
|
||||||
|
if (req.query.masterFilter) {
|
||||||
|
masterFilter = JSON.parse(req.query.masterFilter);
|
||||||
|
}
|
||||||
|
listMaterialsByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/search', isAuthenticated, (req, res) => {
|
router.get('/search', isAuthenticated, (req, res) => {
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import {
|
|||||||
listPartsByPropertiesRouteHandler,
|
listPartsByPropertiesRouteHandler,
|
||||||
getPartStatsRouteHandler,
|
getPartStatsRouteHandler,
|
||||||
getPartHistoryRouteHandler,
|
getPartHistoryRouteHandler,
|
||||||
searchPartsRouteHandler
|
searchPartsRouteHandler,
|
||||||
} from '../../services/management/parts.js';
|
} from '../../services/management/parts.js';
|
||||||
|
|
||||||
// list of parts
|
// list of parts
|
||||||
@ -27,14 +27,18 @@ router.get('/properties', isAuthenticated, (req, res) => {
|
|||||||
let properties = convertPropertiesString(req.query.properties);
|
let properties = convertPropertiesString(req.query.properties);
|
||||||
const allowedFilters = ['product._id'];
|
const allowedFilters = ['product._id'];
|
||||||
const filter = getFilter(req.query, allowedFilters, false);
|
const filter = getFilter(req.query, allowedFilters, false);
|
||||||
listPartsByPropertiesRouteHandler(req, res, properties, filter);
|
var masterFilter = {};
|
||||||
|
if (req.query.masterFilter) {
|
||||||
|
masterFilter = JSON.parse(req.query.masterFilter);
|
||||||
|
}
|
||||||
|
listPartsByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/search', isAuthenticated, (req, res) => {
|
router.get('/search', isAuthenticated, (req, res) => {
|
||||||
const { search } = req.query;
|
const { search } = req.query;
|
||||||
searchPartsRouteHandler(req, res, search);
|
searchPartsRouteHandler(req, res, search);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
router.post('/', isAuthenticated, (req, res) => {
|
router.post('/', isAuthenticated, (req, res) => {
|
||||||
newPartRouteHandler(req, res);
|
newPartRouteHandler(req, res);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import {
|
|||||||
listProductCategoriesByPropertiesRouteHandler,
|
listProductCategoriesByPropertiesRouteHandler,
|
||||||
listProductCategoriesRouteHandler,
|
listProductCategoriesRouteHandler,
|
||||||
newProductCategoryRouteHandler,
|
newProductCategoryRouteHandler,
|
||||||
searchProductCategoriesRouteHandler
|
searchProductCategoriesRouteHandler,
|
||||||
} from '../../services/management/productcategories.js';
|
} from '../../services/management/productcategories.js';
|
||||||
|
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
@ -26,14 +26,18 @@ router.get('/properties', isAuthenticated, (req, res) => {
|
|||||||
const properties = convertPropertiesString(req.query.properties);
|
const properties = convertPropertiesString(req.query.properties);
|
||||||
const allowedFilters = ['name'];
|
const allowedFilters = ['name'];
|
||||||
const filter = getFilter(req.query, allowedFilters, false);
|
const filter = getFilter(req.query, allowedFilters, false);
|
||||||
listProductCategoriesByPropertiesRouteHandler(req, res, properties, filter);
|
var masterFilter = {};
|
||||||
|
if (req.query.masterFilter) {
|
||||||
|
masterFilter = JSON.parse(req.query.masterFilter);
|
||||||
|
}
|
||||||
|
listProductCategoriesByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/search', isAuthenticated, (req, res) => {
|
router.get('/search', isAuthenticated, (req, res) => {
|
||||||
const { search } = req.query;
|
const { search } = req.query;
|
||||||
searchProductCategoriesRouteHandler(req, res, search);
|
searchProductCategoriesRouteHandler(req, res, search);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
router.post('/', isAuthenticated, (req, res) => {
|
router.post('/', isAuthenticated, (req, res) => {
|
||||||
newProductCategoryRouteHandler(req, res);
|
newProductCategoryRouteHandler(req, res);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import {
|
|||||||
listProductsByPropertiesRouteHandler,
|
listProductsByPropertiesRouteHandler,
|
||||||
getProductStatsRouteHandler,
|
getProductStatsRouteHandler,
|
||||||
getProductHistoryRouteHandler,
|
getProductHistoryRouteHandler,
|
||||||
searchProductsRouteHandler
|
searchProductsRouteHandler,
|
||||||
} from '../../services/management/products.js';
|
} from '../../services/management/products.js';
|
||||||
|
|
||||||
// list of products
|
// list of products
|
||||||
@ -27,14 +27,18 @@ router.get('/properties', isAuthenticated, (req, res) => {
|
|||||||
let properties = convertPropertiesString(req.query.properties);
|
let properties = convertPropertiesString(req.query.properties);
|
||||||
const allowedFilters = [];
|
const allowedFilters = [];
|
||||||
const filter = getFilter(req.query, allowedFilters, false);
|
const filter = getFilter(req.query, allowedFilters, false);
|
||||||
listProductsByPropertiesRouteHandler(req, res, properties, filter);
|
var masterFilter = {};
|
||||||
|
if (req.query.masterFilter) {
|
||||||
|
masterFilter = JSON.parse(req.query.masterFilter);
|
||||||
|
}
|
||||||
|
listProductsByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/search', isAuthenticated, (req, res) => {
|
router.get('/search', isAuthenticated, (req, res) => {
|
||||||
const { search } = req.query;
|
const { search } = req.query;
|
||||||
searchProductsRouteHandler(req, res, search);
|
searchProductsRouteHandler(req, res, search);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
router.post('/', isAuthenticated, (req, res) => {
|
router.post('/', isAuthenticated, (req, res) => {
|
||||||
newProductRouteHandler(req, res);
|
newProductRouteHandler(req, res);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import {
|
|||||||
listTaxRatesByPropertiesRouteHandler,
|
listTaxRatesByPropertiesRouteHandler,
|
||||||
getTaxRateStatsRouteHandler,
|
getTaxRateStatsRouteHandler,
|
||||||
getTaxRateHistoryRouteHandler,
|
getTaxRateHistoryRouteHandler,
|
||||||
searchTaxRatesRouteHandler
|
searchTaxRatesRouteHandler,
|
||||||
} from '../../services/management/taxrates.js';
|
} from '../../services/management/taxrates.js';
|
||||||
|
|
||||||
// list of tax rates
|
// list of tax rates
|
||||||
@ -27,14 +27,18 @@ router.get('/properties', isAuthenticated, (req, res) => {
|
|||||||
let properties = convertPropertiesString(req.query.properties);
|
let properties = convertPropertiesString(req.query.properties);
|
||||||
const allowedFilters = ['rateType', 'country', 'active'];
|
const allowedFilters = ['rateType', 'country', 'active'];
|
||||||
const filter = getFilter(req.query, allowedFilters, false);
|
const filter = getFilter(req.query, allowedFilters, false);
|
||||||
listTaxRatesByPropertiesRouteHandler(req, res, properties, filter);
|
var masterFilter = {};
|
||||||
|
if (req.query.masterFilter) {
|
||||||
|
masterFilter = JSON.parse(req.query.masterFilter);
|
||||||
|
}
|
||||||
|
listTaxRatesByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/search', isAuthenticated, (req, res) => {
|
router.get('/search', isAuthenticated, (req, res) => {
|
||||||
const { search } = req.query;
|
const { search } = req.query;
|
||||||
searchTaxRatesRouteHandler(req, res, search);
|
searchTaxRatesRouteHandler(req, res, search);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
router.post('/', isAuthenticated, (req, res) => {
|
router.post('/', isAuthenticated, (req, res) => {
|
||||||
newTaxRateRouteHandler(req, res);
|
newTaxRateRouteHandler(req, res);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import {
|
|||||||
listVendorsByPropertiesRouteHandler,
|
listVendorsByPropertiesRouteHandler,
|
||||||
getVendorStatsRouteHandler,
|
getVendorStatsRouteHandler,
|
||||||
getVendorHistoryRouteHandler,
|
getVendorHistoryRouteHandler,
|
||||||
searchVendorsRouteHandler
|
searchVendorsRouteHandler,
|
||||||
} from '../../services/management/vendors.js';
|
} from '../../services/management/vendors.js';
|
||||||
|
|
||||||
// list of vendors
|
// list of vendors
|
||||||
@ -27,14 +27,18 @@ router.get('/properties', isAuthenticated, (req, res) => {
|
|||||||
let properties = convertPropertiesString(req.query.properties);
|
let properties = convertPropertiesString(req.query.properties);
|
||||||
const allowedFilters = ['country', 'active', 'createdAt', 'updatedAt'];
|
const allowedFilters = ['country', 'active', 'createdAt', 'updatedAt'];
|
||||||
const filter = getFilter(req.query, allowedFilters, false);
|
const filter = getFilter(req.query, allowedFilters, false);
|
||||||
listVendorsByPropertiesRouteHandler(req, res, properties, filter);
|
var masterFilter = {};
|
||||||
|
if (req.query.masterFilter) {
|
||||||
|
masterFilter = JSON.parse(req.query.masterFilter);
|
||||||
|
}
|
||||||
|
listVendorsByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/search', isAuthenticated, (req, res) => {
|
router.get('/search', isAuthenticated, (req, res) => {
|
||||||
const { search } = req.query;
|
const { search } = req.query;
|
||||||
searchVendorsRouteHandler(req, res, search);
|
searchVendorsRouteHandler(req, res, search);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
router.post('/', isAuthenticated, (req, res) => {
|
router.post('/', isAuthenticated, (req, res) => {
|
||||||
newVendorRouteHandler(req, res);
|
newVendorRouteHandler(req, res);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -26,7 +26,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
|
|||||||
let properties = convertPropertiesString(req.query.properties);
|
let properties = convertPropertiesString(req.query.properties);
|
||||||
const allowedFilters = ['parent'];
|
const allowedFilters = ['parent'];
|
||||||
const filter = getFilter(req.query, allowedFilters, false);
|
const filter = getFilter(req.query, allowedFilters, false);
|
||||||
listNotesByPropertiesRouteHandler(req, res, properties, filter);
|
var masterFilter = {};
|
||||||
|
if (req.query.masterFilter) {
|
||||||
|
masterFilter = JSON.parse(req.query.masterFilter);
|
||||||
|
}
|
||||||
|
listNotesByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||||
});
|
});
|
||||||
|
|
||||||
// create new note
|
// create new note
|
||||||
|
|||||||
@ -22,7 +22,11 @@ router.get('/', isAuthenticated, (req, res) => {
|
|||||||
router.get('/properties', isAuthenticated, (req, res) => {
|
router.get('/properties', isAuthenticated, (req, res) => {
|
||||||
const properties = convertPropertiesString(req.query.properties);
|
const properties = convertPropertiesString(req.query.properties);
|
||||||
const filter = getFilter(req.query, ['name'], false);
|
const filter = getFilter(req.query, ['name'], false);
|
||||||
listFilamentProfilesByPropertiesRouteHandler(req, res, properties, filter);
|
var masterFilter = {};
|
||||||
|
if (req.query.masterFilter) {
|
||||||
|
masterFilter = JSON.parse(req.query.masterFilter);
|
||||||
|
}
|
||||||
|
listFilamentProfilesByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/search', isAuthenticated, (req, res) => {
|
router.get('/search', isAuthenticated, (req, res) => {
|
||||||
|
|||||||
@ -26,7 +26,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
|
|||||||
let properties = convertPropertiesString(req.query.properties);
|
let properties = convertPropertiesString(req.query.properties);
|
||||||
const allowedFilters = ['filament', 'filament._id', 'filamentSku', 'filamentSku._id'];
|
const allowedFilters = ['filament', 'filament._id', 'filamentSku', 'filamentSku._id'];
|
||||||
const filter = getFilter(req.query, allowedFilters, false);
|
const filter = getFilter(req.query, allowedFilters, false);
|
||||||
listGCodeFilesByPropertiesRouteHandler(req, res, properties, filter);
|
var masterFilter = {};
|
||||||
|
if (req.query.masterFilter) {
|
||||||
|
masterFilter = JSON.parse(req.query.masterFilter);
|
||||||
|
}
|
||||||
|
listGCodeFilesByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||||
});
|
});
|
||||||
router.get('/search', isAuthenticated, (req, res) => {
|
router.get('/search', isAuthenticated, (req, res) => {
|
||||||
const { search } = req.query;
|
const { search } = req.query;
|
||||||
|
|||||||
@ -27,7 +27,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
|
|||||||
let properties = convertPropertiesString(req.query.properties);
|
let properties = convertPropertiesString(req.query.properties);
|
||||||
const allowedFilters = ['state'];
|
const allowedFilters = ['state'];
|
||||||
const filter = getFilter(req.query, allowedFilters, false);
|
const filter = getFilter(req.query, allowedFilters, false);
|
||||||
listJobsByPropertiesRouteHandler(req, res, properties, filter);
|
var masterFilter = {};
|
||||||
|
if (req.query.masterFilter) {
|
||||||
|
masterFilter = JSON.parse(req.query.masterFilter);
|
||||||
|
}
|
||||||
|
listJobsByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||||
});
|
});
|
||||||
router.get('/search', isAuthenticated, (req, res) => {
|
router.get('/search', isAuthenticated, (req, res) => {
|
||||||
const { search } = req.query;
|
const { search } = req.query;
|
||||||
|
|||||||
@ -22,7 +22,11 @@ router.get('/', isAuthenticated, (req, res) => {
|
|||||||
router.get('/properties', isAuthenticated, (req, res) => {
|
router.get('/properties', isAuthenticated, (req, res) => {
|
||||||
const properties = convertPropertiesString(req.query.properties);
|
const properties = convertPropertiesString(req.query.properties);
|
||||||
const filter = getFilter(req.query, ['name'], false);
|
const filter = getFilter(req.query, ['name'], false);
|
||||||
listPrinterProfilesByPropertiesRouteHandler(req, res, properties, filter);
|
var masterFilter = {};
|
||||||
|
if (req.query.masterFilter) {
|
||||||
|
masterFilter = JSON.parse(req.query.masterFilter);
|
||||||
|
}
|
||||||
|
listPrinterProfilesByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get('/search', isAuthenticated, (req, res) => {
|
router.get('/search', isAuthenticated, (req, res) => {
|
||||||
|
|||||||
@ -26,7 +26,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
|
|||||||
let properties = convertPropertiesString(req.query.properties);
|
let properties = convertPropertiesString(req.query.properties);
|
||||||
const allowedFilters = ['tags'];
|
const allowedFilters = ['tags'];
|
||||||
const filter = getFilter(req.query, allowedFilters, false);
|
const filter = getFilter(req.query, allowedFilters, false);
|
||||||
listPrintersByPropertiesRouteHandler(req, res, properties, filter);
|
var masterFilter = {};
|
||||||
|
if (req.query.masterFilter) {
|
||||||
|
masterFilter = JSON.parse(req.query.masterFilter);
|
||||||
|
}
|
||||||
|
listPrintersByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||||
});
|
});
|
||||||
router.get('/search', isAuthenticated, (req, res) => {
|
router.get('/search', isAuthenticated, (req, res) => {
|
||||||
const { search } = req.query;
|
const { search } = req.query;
|
||||||
|
|||||||
@ -24,7 +24,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
|
|||||||
let properties = convertPropertiesString(req.query.properties);
|
let properties = convertPropertiesString(req.query.properties);
|
||||||
const allowedFilters = ['job'];
|
const allowedFilters = ['job'];
|
||||||
const filter = getFilter(req.query, allowedFilters, false);
|
const filter = getFilter(req.query, allowedFilters, false);
|
||||||
listSubJobsByPropertiesRouteHandler(req, res, properties, filter);
|
var masterFilter = {};
|
||||||
|
if (req.query.masterFilter) {
|
||||||
|
masterFilter = JSON.parse(req.query.masterFilter);
|
||||||
|
}
|
||||||
|
listSubJobsByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||||
});
|
});
|
||||||
router.get('/search', isAuthenticated, (req, res) => {
|
router.get('/search', isAuthenticated, (req, res) => {
|
||||||
const { search } = req.query;
|
const { search } = req.query;
|
||||||
|
|||||||
@ -27,7 +27,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
|
|||||||
let properties = convertPropertiesString(req.query.properties);
|
let properties = convertPropertiesString(req.query.properties);
|
||||||
const allowedFilters = ['country', 'active', 'createdAt', 'updatedAt'];
|
const allowedFilters = ['country', 'active', 'createdAt', 'updatedAt'];
|
||||||
const filter = getFilter(req.query, allowedFilters, false);
|
const filter = getFilter(req.query, allowedFilters, false);
|
||||||
listClientsByPropertiesRouteHandler(req, res, properties, filter);
|
var masterFilter = {};
|
||||||
|
if (req.query.masterFilter) {
|
||||||
|
masterFilter = JSON.parse(req.query.masterFilter);
|
||||||
|
}
|
||||||
|
listClientsByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||||
});
|
});
|
||||||
router.get('/search', isAuthenticated, (req, res) => {
|
router.get('/search', isAuthenticated, (req, res) => {
|
||||||
const { search } = req.query;
|
const { search } = req.query;
|
||||||
|
|||||||
@ -48,7 +48,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
|
|||||||
'updatedAt',
|
'updatedAt',
|
||||||
];
|
];
|
||||||
const filter = getFilter(req.query, allowedFilters, false);
|
const filter = getFilter(req.query, allowedFilters, false);
|
||||||
listListingsByPropertiesRouteHandler(req, res, properties, filter);
|
var masterFilter = {};
|
||||||
|
if (req.query.masterFilter) {
|
||||||
|
masterFilter = JSON.parse(req.query.masterFilter);
|
||||||
|
}
|
||||||
|
listListingsByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||||
});
|
});
|
||||||
router.get('/search', isAuthenticated, (req, res) => {
|
router.get('/search', isAuthenticated, (req, res) => {
|
||||||
const { search } = req.query;
|
const { search } = req.query;
|
||||||
|
|||||||
@ -46,7 +46,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
|
|||||||
'updatedAt',
|
'updatedAt',
|
||||||
];
|
];
|
||||||
const filter = getFilter(req.query, allowedFilters, false);
|
const filter = getFilter(req.query, allowedFilters, false);
|
||||||
listListingVarientsByPropertiesRouteHandler(req, res, properties, filter);
|
var masterFilter = {};
|
||||||
|
if (req.query.masterFilter) {
|
||||||
|
masterFilter = JSON.parse(req.query.masterFilter);
|
||||||
|
}
|
||||||
|
listListingVarientsByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||||
});
|
});
|
||||||
router.get('/search', isAuthenticated, (req, res) => {
|
router.get('/search', isAuthenticated, (req, res) => {
|
||||||
const { search } = req.query;
|
const { search } = req.query;
|
||||||
|
|||||||
@ -32,7 +32,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
|
|||||||
let properties = convertPropertiesString(req.query.properties);
|
let properties = convertPropertiesString(req.query.properties);
|
||||||
const allowedFilters = ['name', 'provider', 'active', 'connected', 'state.type', 'createdAt', 'updatedAt'];
|
const allowedFilters = ['name', 'provider', 'active', 'connected', 'state.type', 'createdAt', 'updatedAt'];
|
||||||
const filter = getFilter(req.query, allowedFilters, false);
|
const filter = getFilter(req.query, allowedFilters, false);
|
||||||
listMarketplacesByPropertiesRouteHandler(req, res, properties, filter);
|
var masterFilter = {};
|
||||||
|
if (req.query.masterFilter) {
|
||||||
|
masterFilter = JSON.parse(req.query.masterFilter);
|
||||||
|
}
|
||||||
|
listMarketplacesByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||||
});
|
});
|
||||||
router.get('/search', isAuthenticated, (req, res) => {
|
router.get('/search', isAuthenticated, (req, res) => {
|
||||||
const { search } = req.query;
|
const { search } = req.query;
|
||||||
|
|||||||
@ -52,12 +52,14 @@ export const listTaxRecordsByPropertiesRouteHandler = async (
|
|||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
properties = '',
|
properties = '',
|
||||||
filter = {}
|
filter = {},
|
||||||
|
masterFilter = {}
|
||||||
) => {
|
) => {
|
||||||
const result = await listObjectsByProperties({
|
const result = await listObjectsByProperties({
|
||||||
model: taxRecordModel,
|
model: taxRecordModel,
|
||||||
properties,
|
properties,
|
||||||
filter,
|
filter,
|
||||||
|
masterFilter,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result?.error) {
|
if (result?.error) {
|
||||||
|
|||||||
@ -52,12 +52,14 @@ export const listCouriersByPropertiesRouteHandler = async (
|
|||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
properties = '',
|
properties = '',
|
||||||
filter = {}
|
filter = {},
|
||||||
|
masterFilter = {}
|
||||||
) => {
|
) => {
|
||||||
const result = await listObjectsByProperties({
|
const result = await listObjectsByProperties({
|
||||||
model: courierModel,
|
model: courierModel,
|
||||||
properties,
|
properties,
|
||||||
filter,
|
filter,
|
||||||
|
masterFilter,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result?.error) {
|
if (result?.error) {
|
||||||
|
|||||||
@ -53,12 +53,14 @@ export const listCourierServicesByPropertiesRouteHandler = async (
|
|||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
properties = '',
|
properties = '',
|
||||||
filter = {}
|
filter = {},
|
||||||
|
masterFilter = {}
|
||||||
) => {
|
) => {
|
||||||
const result = await listObjectsByProperties({
|
const result = await listObjectsByProperties({
|
||||||
model: courierServiceModel,
|
model: courierServiceModel,
|
||||||
properties,
|
properties,
|
||||||
filter,
|
filter,
|
||||||
|
masterFilter,
|
||||||
populate: ['courier', 'costTaxRate'],
|
populate: ['courier', 'costTaxRate'],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -52,12 +52,14 @@ export const listDocumentJobsByPropertiesRouteHandler = async (
|
|||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
properties = '',
|
properties = '',
|
||||||
filter = {}
|
filter = {},
|
||||||
|
masterFilter = {}
|
||||||
) => {
|
) => {
|
||||||
const result = await listObjectsByProperties({
|
const result = await listObjectsByProperties({
|
||||||
model: documentJobModel,
|
model: documentJobModel,
|
||||||
properties,
|
properties,
|
||||||
filter,
|
filter,
|
||||||
|
masterFilter,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result?.error) {
|
if (result?.error) {
|
||||||
|
|||||||
@ -55,12 +55,14 @@ export const listDocumentPrintersByPropertiesRouteHandler = async (
|
|||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
properties = '',
|
properties = '',
|
||||||
filter = {}
|
filter = {},
|
||||||
|
masterFilter = {}
|
||||||
) => {
|
) => {
|
||||||
const result = await listObjectsByProperties({
|
const result = await listObjectsByProperties({
|
||||||
model: documentPrinterModel,
|
model: documentPrinterModel,
|
||||||
properties,
|
properties,
|
||||||
filter,
|
filter,
|
||||||
|
masterFilter,
|
||||||
populate: ['currentDocumentSize', 'host'],
|
populate: ['currentDocumentSize', 'host'],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -52,12 +52,14 @@ export const listDocumentSizesByPropertiesRouteHandler = async (
|
|||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
properties = '',
|
properties = '',
|
||||||
filter = {}
|
filter = {},
|
||||||
|
masterFilter = {}
|
||||||
) => {
|
) => {
|
||||||
const result = await listObjectsByProperties({
|
const result = await listObjectsByProperties({
|
||||||
model: documentSizeModel,
|
model: documentSizeModel,
|
||||||
properties,
|
properties,
|
||||||
filter,
|
filter,
|
||||||
|
masterFilter,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result?.error) {
|
if (result?.error) {
|
||||||
|
|||||||
@ -55,12 +55,14 @@ export const listFilamentsByPropertiesRouteHandler = async (
|
|||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
properties = [],
|
properties = [],
|
||||||
filter = {}
|
filter = {},
|
||||||
|
masterFilter = {}
|
||||||
) => {
|
) => {
|
||||||
const result = await listObjectsByProperties({
|
const result = await listObjectsByProperties({
|
||||||
model: filamentModel,
|
model: filamentModel,
|
||||||
properties,
|
properties,
|
||||||
filter,
|
filter,
|
||||||
|
masterFilter,
|
||||||
populate: [],
|
populate: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -53,12 +53,14 @@ export const listMaterialsByPropertiesRouteHandler = async (
|
|||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
properties = [],
|
properties = [],
|
||||||
filter = {}
|
filter = {},
|
||||||
|
masterFilter = {}
|
||||||
) => {
|
) => {
|
||||||
const result = await listObjectsByProperties({
|
const result = await listObjectsByProperties({
|
||||||
model: materialModel,
|
model: materialModel,
|
||||||
properties,
|
properties,
|
||||||
filter,
|
filter,
|
||||||
|
masterFilter,
|
||||||
populate: [],
|
populate: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -49,11 +49,18 @@ export const listPartsRouteHandler = async (
|
|||||||
res.send(result);
|
res.send(result);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const listPartsByPropertiesRouteHandler = async (req, res, properties = '', filter = {}) => {
|
export const listPartsByPropertiesRouteHandler = async (
|
||||||
|
req,
|
||||||
|
res,
|
||||||
|
properties = '',
|
||||||
|
filter = {},
|
||||||
|
masterFilter = {}
|
||||||
|
) => {
|
||||||
const result = await listObjectsByProperties({
|
const result = await listObjectsByProperties({
|
||||||
model: partModel,
|
model: partModel,
|
||||||
properties,
|
properties,
|
||||||
filter,
|
filter,
|
||||||
|
masterFilter,
|
||||||
populate: [],
|
populate: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -54,12 +54,14 @@ export const listProductCategoriesByPropertiesRouteHandler = async (
|
|||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
properties = [],
|
properties = [],
|
||||||
filter = {}
|
filter = {},
|
||||||
|
masterFilter = {}
|
||||||
) => {
|
) => {
|
||||||
const result = await listObjectsByProperties({
|
const result = await listObjectsByProperties({
|
||||||
model: productCategoryModel,
|
model: productCategoryModel,
|
||||||
properties,
|
properties,
|
||||||
filter,
|
filter,
|
||||||
|
masterFilter,
|
||||||
populate: [],
|
populate: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -53,12 +53,14 @@ export const listProductsByPropertiesRouteHandler = async (
|
|||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
properties = '',
|
properties = '',
|
||||||
filter = {}
|
filter = {},
|
||||||
|
masterFilter = {}
|
||||||
) => {
|
) => {
|
||||||
const result = await listObjectsByProperties({
|
const result = await listObjectsByProperties({
|
||||||
model: productModel,
|
model: productModel,
|
||||||
properties,
|
properties,
|
||||||
filter,
|
filter,
|
||||||
|
masterFilter,
|
||||||
populate: ['productCategory', 'vendor'],
|
populate: ['productCategory', 'vendor'],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -52,12 +52,14 @@ export const listTaxRatesByPropertiesRouteHandler = async (
|
|||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
properties = '',
|
properties = '',
|
||||||
filter = {}
|
filter = {},
|
||||||
|
masterFilter = {}
|
||||||
) => {
|
) => {
|
||||||
const result = await listObjectsByProperties({
|
const result = await listObjectsByProperties({
|
||||||
model: taxRateModel,
|
model: taxRateModel,
|
||||||
properties,
|
properties,
|
||||||
filter,
|
filter,
|
||||||
|
masterFilter,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result?.error) {
|
if (result?.error) {
|
||||||
|
|||||||
@ -52,12 +52,14 @@ export const listVendorsByPropertiesRouteHandler = async (
|
|||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
properties = '',
|
properties = '',
|
||||||
filter = {}
|
filter = {},
|
||||||
|
masterFilter = {}
|
||||||
) => {
|
) => {
|
||||||
const result = await listObjectsByProperties({
|
const result = await listObjectsByProperties({
|
||||||
model: vendorModel,
|
model: vendorModel,
|
||||||
properties,
|
properties,
|
||||||
filter,
|
filter,
|
||||||
|
masterFilter,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result?.error) {
|
if (result?.error) {
|
||||||
|
|||||||
@ -51,11 +51,18 @@ export const listNotesRouteHandler = async (
|
|||||||
res.send(result);
|
res.send(result);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const listNotesByPropertiesRouteHandler = async (req, res, properties = '', filter = {}) => {
|
export const listNotesByPropertiesRouteHandler = async (
|
||||||
|
req,
|
||||||
|
res,
|
||||||
|
properties = '',
|
||||||
|
filter = {},
|
||||||
|
masterFilter = {}
|
||||||
|
) => {
|
||||||
const result = await listObjectsByProperties({
|
const result = await listObjectsByProperties({
|
||||||
model: noteModel,
|
model: noteModel,
|
||||||
properties,
|
properties,
|
||||||
filter,
|
filter,
|
||||||
|
masterFilter,
|
||||||
populate: ['noteType', 'user'],
|
populate: ['noteType', 'user'],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -203,12 +203,14 @@ export const listFilamentProfilesByPropertiesRouteHandler = async (
|
|||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
properties = [],
|
properties = [],
|
||||||
filter = {}
|
filter = {},
|
||||||
|
masterFilter = {}
|
||||||
) => {
|
) => {
|
||||||
const result = await listObjectsByProperties({
|
const result = await listObjectsByProperties({
|
||||||
model: filamentProfileModel,
|
model: filamentProfileModel,
|
||||||
properties,
|
properties,
|
||||||
filter,
|
filter,
|
||||||
|
masterFilter,
|
||||||
populate: FILAMENT_PROFILE_POPULATE,
|
populate: FILAMENT_PROFILE_POPULATE,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -53,12 +53,14 @@ export const listGCodeFilesByPropertiesRouteHandler = async (
|
|||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
properties = '',
|
properties = '',
|
||||||
filter = {}
|
filter = {},
|
||||||
|
masterFilter = {}
|
||||||
) => {
|
) => {
|
||||||
const result = await listObjectsByProperties({
|
const result = await listObjectsByProperties({
|
||||||
model: gcodeFileModel,
|
model: gcodeFileModel,
|
||||||
properties,
|
properties,
|
||||||
filter,
|
filter,
|
||||||
|
masterFilter,
|
||||||
populate: ['filament', 'filamentSku'],
|
populate: ['filament', 'filamentSku'],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -91,12 +91,14 @@ export const listPrinterProfilesByPropertiesRouteHandler = async (
|
|||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
properties = [],
|
properties = [],
|
||||||
filter = {}
|
filter = {},
|
||||||
|
masterFilter = {}
|
||||||
) => {
|
) => {
|
||||||
const result = await listObjectsByProperties({
|
const result = await listObjectsByProperties({
|
||||||
model: printerProfileModel,
|
model: printerProfileModel,
|
||||||
properties,
|
properties,
|
||||||
filter,
|
filter,
|
||||||
|
masterFilter,
|
||||||
populate: ['printer'],
|
populate: ['printer'],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -54,12 +54,14 @@ export const listPrintersByPropertiesRouteHandler = async (
|
|||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
properties = '',
|
properties = '',
|
||||||
filter = {}
|
filter = {},
|
||||||
|
masterFilter = {}
|
||||||
) => {
|
) => {
|
||||||
const result = await listObjectsByProperties({
|
const result = await listObjectsByProperties({
|
||||||
model: printerModel,
|
model: printerModel,
|
||||||
properties,
|
properties,
|
||||||
filter,
|
filter,
|
||||||
|
masterFilter,
|
||||||
populate: ['vendor', 'host'],
|
populate: ['vendor', 'host'],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -52,12 +52,14 @@ export const listClientsByPropertiesRouteHandler = async (
|
|||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
properties = '',
|
properties = '',
|
||||||
filter = {}
|
filter = {},
|
||||||
|
masterFilter = {}
|
||||||
) => {
|
) => {
|
||||||
const result = await listObjectsByProperties({
|
const result = await listObjectsByProperties({
|
||||||
model: clientModel,
|
model: clientModel,
|
||||||
properties,
|
properties,
|
||||||
filter,
|
filter,
|
||||||
|
masterFilter,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result?.error) {
|
if (result?.error) {
|
||||||
|
|||||||
@ -93,12 +93,14 @@ export const listListingsByPropertiesRouteHandler = async (
|
|||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
properties = '',
|
properties = '',
|
||||||
filter = {}
|
filter = {},
|
||||||
|
masterFilter = {}
|
||||||
) => {
|
) => {
|
||||||
const result = await listObjectsByProperties({
|
const result = await listObjectsByProperties({
|
||||||
model: listingModel,
|
model: listingModel,
|
||||||
properties,
|
properties,
|
||||||
filter,
|
filter,
|
||||||
|
masterFilter,
|
||||||
populate: ['product', 'vendor', 'stockLocation', 'marketplace', 'courierServices'],
|
populate: ['product', 'vendor', 'stockLocation', 'marketplace', 'courierServices'],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -63,12 +63,14 @@ export const listListingVarientsByPropertiesRouteHandler = async (
|
|||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
properties = '',
|
properties = '',
|
||||||
filter = {}
|
filter = {},
|
||||||
|
masterFilter = {}
|
||||||
) => {
|
) => {
|
||||||
const result = await listObjectsByProperties({
|
const result = await listObjectsByProperties({
|
||||||
model: listingVarientModel,
|
model: listingVarientModel,
|
||||||
properties,
|
properties,
|
||||||
filter,
|
filter,
|
||||||
|
masterFilter,
|
||||||
populate: POPULATE_FIELDS,
|
populate: POPULATE_FIELDS,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -53,12 +53,14 @@ export const listMarketplacesByPropertiesRouteHandler = async (
|
|||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
properties = '',
|
properties = '',
|
||||||
filter = {}
|
filter = {},
|
||||||
|
masterFilter = {}
|
||||||
) => {
|
) => {
|
||||||
const result = await listObjectsByProperties({
|
const result = await listObjectsByProperties({
|
||||||
model: marketplaceModel,
|
model: marketplaceModel,
|
||||||
properties,
|
properties,
|
||||||
filter,
|
filter,
|
||||||
|
masterFilter,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result?.error) {
|
if (result?.error) {
|
||||||
|
|||||||
@ -1037,6 +1037,7 @@ function flatternObjectIds(object) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function expandObjectIds(input) {
|
function expandObjectIds(input) {
|
||||||
|
const excludedFields = ['createdAt', 'updatedAt', 'name', '_id'];
|
||||||
// Helper to check if a value is an ObjectId or a 24-char hex string
|
// Helper to check if a value is an ObjectId or a 24-char hex string
|
||||||
function isObjectId(val) {
|
function isObjectId(val) {
|
||||||
// Check for MongoDB ObjectId instance
|
// Check for MongoDB ObjectId instance
|
||||||
@ -1053,8 +1054,8 @@ function expandObjectIds(input) {
|
|||||||
} else if (value && typeof value === 'object' && !(value instanceof mongoose.Types.ObjectId)) {
|
} else if (value && typeof value === 'object' && !(value instanceof mongoose.Types.ObjectId)) {
|
||||||
var result = {};
|
var result = {};
|
||||||
for (const [key, val] of Object.entries(value)) {
|
for (const [key, val] of Object.entries(value)) {
|
||||||
if (key === '_id') {
|
if (excludedFields.includes(key)) {
|
||||||
// Do not expand keys that are already named _id
|
// Do not expand keys that are excluded
|
||||||
result[key] = val.toString();
|
result[key] = val.toString();
|
||||||
} else if (isObjectId(val)) {
|
} else if (isObjectId(val)) {
|
||||||
result[key] = { _id: val };
|
result[key] = { _id: val };
|
||||||
@ -1108,6 +1109,7 @@ function getFilter(query, allowedFilters, parse = true) {
|
|||||||
clauses.push(parse ? parseFilter(key, value) : { [key]: value });
|
clauses.push(parse ? parseFilter(key, value) : { [key]: value });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log('clauses', clauses);
|
||||||
return mergeFilterClauses(clauses);
|
return mergeFilterClauses(clauses);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user