diff --git a/src/routes/finance/invoices.js b/src/routes/finance/invoices.js index e366189..2f51cf0 100644 --- a/src/routes/finance/invoices.js +++ b/src/routes/finance/invoices.js @@ -12,10 +12,6 @@ const listAllowedFilters = [ 'state', 'vendor._id', 'client._id', - 'from', - 'from._id', - 'to', - 'to._id', 'order', 'order._id', 'orderType', @@ -27,10 +23,6 @@ const listAllowedSorters = ['createdAt', 'state', 'updatedAt', 'invoiceDate', 'd const propertiesAllowedFilters = [ 'vendor', 'client', - 'from', - 'from._id', - 'to', - 'to._id', 'orderType', 'order', 'order._id', diff --git a/src/routes/finance/paymentpolicies.js b/src/routes/finance/paymentpolicies.js index 192288d..964b942 100644 --- a/src/routes/finance/paymentpolicies.js +++ b/src/routes/finance/paymentpolicies.js @@ -21,13 +21,12 @@ const router = express.Router(); const listAllowedFilters = [ 'name', 'immediatePay', - 'marketplaces.marketplace', 'createdAt', 'updatedAt', '_reference', ]; const listAllowedSorters = ['name', 'immediatePay', 'createdAt', '_id', 'updatedAt']; -const propertiesAllowedFilters = ['name', 'immediatePay', 'marketplaces.marketplace']; +const propertiesAllowedFilters = ['name', 'immediatePay']; router.get('/', isAuthenticated, checkPermissions('paymentPolicy', 'list'), async (req, res) => { const { page, limit, property, search, sortProperty, sortOrder } = req.query; diff --git a/src/routes/inventory/partstocks.js b/src/routes/inventory/partstocks.js index b8b7aba..329678f 100644 --- a/src/routes/inventory/partstocks.js +++ b/src/routes/inventory/partstocks.js @@ -6,6 +6,8 @@ import { getFilter, convertPropertiesString, getSort } from '../../utils.js'; const router = express.Router(); const listAllowedFilters = [ + 'part', + 'part._id', 'partSku', 'partSku._id', 'state', @@ -16,7 +18,14 @@ const listAllowedFilters = [ 'updatedAt', '_reference', ]; -const listAllowedSorters = ['partSku', 'currentQuantity', 'state', 'createdAt', 'updatedAt']; +const listAllowedSorters = [ + 'part', + 'partSku', + 'currentQuantity', + 'state', + 'createdAt', + 'updatedAt', +]; const propertiesAllowedFilters = ['part', 'state.type']; import { listPartStocksRouteHandler, diff --git a/src/routes/inventory/productstocks.js b/src/routes/inventory/productstocks.js index 8e7b585..5c19861 100644 --- a/src/routes/inventory/productstocks.js +++ b/src/routes/inventory/productstocks.js @@ -6,6 +6,8 @@ import { getFilter, convertPropertiesString, getSort } from '../../utils.js'; const router = express.Router(); const listAllowedFilters = [ + 'product', + 'product._id', 'productSku', 'productSku._id', 'state', @@ -16,8 +18,16 @@ const listAllowedFilters = [ 'updatedAt', '_reference', ]; -const listAllowedSorters = ['productSku', 'currentQuantity', 'state', 'createdAt', 'updatedAt']; -const propertiesAllowedFilters = ['productSku', 'state.type']; +const listAllowedSorters = [ + 'product', + 'productSku', + 'currentQuantity', + 'state', + 'createdAt', + 'updatedAt', + 'stockLocation', +]; +const propertiesAllowedFilters = ['product', 'productSku', 'state.type']; import { listProductStocksRouteHandler, getProductStockRouteHandler, diff --git a/src/routes/inventory/stocktransfers.js b/src/routes/inventory/stocktransfers.js index 0857245..0ddd07c 100644 --- a/src/routes/inventory/stocktransfers.js +++ b/src/routes/inventory/stocktransfers.js @@ -8,6 +8,8 @@ const router = express.Router(); const listAllowedFilters = [ 'state', 'state.type', + 'fromLocation', + 'toLocation', 'postedAt', 'createdAt', 'updatedAt', diff --git a/src/routes/management/courierservice.js b/src/routes/management/courierservice.js index 975ced9..88f9de3 100644 --- a/src/routes/management/courierservice.js +++ b/src/routes/management/courierservice.js @@ -15,7 +15,8 @@ const listAllowedFilters = [ 'deliveryTime', 'cost', 'costWithTax', - 'marketplaces.marketplace', + 'additionalCost', + 'additionalCostWithTax', 'createdAt', 'updatedAt', '_reference', @@ -25,8 +26,11 @@ const listAllowedSorters = [ 'courier', 'active', 'tracked', + 'deliveryTime', 'cost', 'costWithTax', + 'additionalCost', + 'additionalCostWithTax', 'estimatedDeliveryTime', 'createdAt', '_id', @@ -42,7 +46,8 @@ const propertiesAllowedFilters = [ 'deliveryTime', 'cost', 'costWithTax', - 'marketplaces.marketplace', + 'additionalCost', + 'additionalCostWithTax', ]; import { listCourierServicesRouteHandler, diff --git a/src/routes/management/documentprinters.js b/src/routes/management/documentprinters.js index 54ffaab..de61fc0 100644 --- a/src/routes/management/documentprinters.js +++ b/src/routes/management/documentprinters.js @@ -11,11 +11,20 @@ const listAllowedFilters = [ 'active', 'isGlobal', 'state', + 'connection.port', 'createdAt', 'updatedAt', '_reference', ]; -const listAllowedSorters = ['name', 'documentSize', 'connectedAt', 'updatedAt', 'state', 'createdAt']; +const listAllowedSorters = [ + 'name', + 'documentSize', + 'connectedAt', + 'connection.port', + 'updatedAt', + 'state', + 'createdAt', +]; const propertiesAllowedFilters = ['tags']; import { listDocumentPrintersRouteHandler, diff --git a/src/routes/management/filaments.js b/src/routes/management/filaments.js index 4a300da..484e25b 100644 --- a/src/routes/management/filaments.js +++ b/src/routes/management/filaments.js @@ -11,7 +11,10 @@ const listAllowedFilters = [ 'material._id', 'diameter', 'name', + 'density', + 'emptySpoolWeight', 'cost', + 'costWithTax', 'createdAt', 'updatedAt', '_reference', @@ -21,6 +24,9 @@ const listAllowedSorters = [ 'createdAt', 'vendor', 'material', + 'diameter', + 'density', + 'emptySpoolWeight', 'cost', 'costWithTax', 'updatedAt', diff --git a/src/routes/management/parts.js b/src/routes/management/parts.js index f23e986..511fa00 100644 --- a/src/routes/management/parts.js +++ b/src/routes/management/parts.js @@ -5,13 +5,26 @@ import { getFilter, convertPropertiesString, getSort } from '../../utils.js'; const router = express.Router(); -const listAllowedFilters = ['product._id', '_id', 'name', 'createdAt', 'updatedAt', '_reference']; +const listAllowedFilters = [ + 'product._id', + '_id', + 'name', + 'cost', + 'costWithTax', + 'price', + 'margin', + 'priceWithTax', + 'createdAt', + 'updatedAt', + '_reference', +]; const listAllowedSorters = [ 'name', 'priceMode', 'cost', 'costWithTax', 'price', + 'margin', 'priceWithTax', 'createdAt', 'updatedAt', @@ -59,24 +72,15 @@ router.get('/properties', checkPermissions('part', 'list'), isAuthenticated, asy listPartsByPropertiesRouteHandler(req, res, properties, filter, masterFilter); }); -router.get( - '/values', - checkPermissions('part', 'list'), - isAuthenticated, - async (req, res) => { - const { property } = req.query; - const filter = await getFilter(req.query, listAllowedFilters, true); - var masterFilter = {}; - if (req.query.masterFilter) { - masterFilter = await getFilter( - JSON.parse(req.query.masterFilter), - listAllowedFilters, - true - ); - } - getPartPropertyValuesRouteHandler(req, res, property, filter, masterFilter); +router.get('/values', checkPermissions('part', 'list'), isAuthenticated, async (req, res) => { + const { property } = req.query; + const filter = await getFilter(req.query, listAllowedFilters, true); + var masterFilter = {}; + if (req.query.masterFilter) { + masterFilter = await getFilter(JSON.parse(req.query.masterFilter), listAllowedFilters, true); } -); + getPartPropertyValuesRouteHandler(req, res, property, filter, masterFilter); +}); router.get('/search', checkPermissions('part', 'list'), isAuthenticated, async (req, res) => { const { search } = req.query; diff --git a/src/routes/management/partskus.js b/src/routes/management/partskus.js index 4f28f42..bfaa7f1 100644 --- a/src/routes/management/partskus.js +++ b/src/routes/management/partskus.js @@ -12,7 +12,10 @@ const listAllowedFilters = [ 'part._id', 'name', 'cost', + 'costWithTax', 'price', + 'priceWithTax', + 'margin', 'createdAt', 'updatedAt', '_reference', @@ -25,6 +28,7 @@ const listAllowedSorters = [ 'costWithTax', 'price', 'priceWithTax', + 'margin', 'createdAt', 'updatedAt', ]; diff --git a/src/routes/management/products.js b/src/routes/management/products.js index 3cbb540..33084ce 100644 --- a/src/routes/management/products.js +++ b/src/routes/management/products.js @@ -11,6 +11,11 @@ const listAllowedFilters = [ 'globalPrice', 'productCategory', 'productCategory._id', + 'cost', + 'costWithTax', + 'price', + 'margin', + 'priceWithTax', 'createdAt', 'updatedAt', '_reference', @@ -24,6 +29,7 @@ const listAllowedSorters = [ 'cost', 'costWithTax', 'price', + 'margin', 'priceWithTax', 'updatedAt', ]; diff --git a/src/routes/management/productskus.js b/src/routes/management/productskus.js index 9d5156f..b560e2a 100644 --- a/src/routes/management/productskus.js +++ b/src/routes/management/productskus.js @@ -12,7 +12,10 @@ const listAllowedFilters = [ 'product._id', 'name', 'cost', + 'costWithTax', 'price', + 'priceWithTax', + 'margin', 'createdAt', 'updatedAt', '_reference', @@ -25,6 +28,7 @@ const listAllowedSorters = [ 'costWithTax', 'price', 'priceWithTax', + 'margin', 'createdAt', 'updatedAt', ]; diff --git a/src/routes/management/stockauditlevels.js b/src/routes/management/stockauditlevels.js index b71e853..d42ada8 100644 --- a/src/routes/management/stockauditlevels.js +++ b/src/routes/management/stockauditlevels.js @@ -6,7 +6,7 @@ import { getFilter, convertPropertiesString, getSort } from '../../utils.js'; const router = express.Router(); const listAllowedFilters = ['name', 'createdAt', 'updatedAt', '_reference', 'tags']; -const listAllowedSorters = ['name', 'createdAt', '_id', 'updatedAt', 'tags']; +const listAllowedSorters = ['name', 'createdAt', 'updatedAt']; const propertiesAllowedFilters = ['tags']; import { diff --git a/src/routes/management/taxrates.js b/src/routes/management/taxrates.js index 18707a7..294b751 100644 --- a/src/routes/management/taxrates.js +++ b/src/routes/management/taxrates.js @@ -12,7 +12,6 @@ const listAllowedFilters = [ 'active', 'country', 'jurisdiction', - 'marketplaces.marketplace', 'createdAt', 'updatedAt', '_reference', diff --git a/src/routes/sales/fulfillmentpolicies.js b/src/routes/sales/fulfillmentpolicies.js index 6ec381a..6dcfdc1 100644 --- a/src/routes/sales/fulfillmentpolicies.js +++ b/src/routes/sales/fulfillmentpolicies.js @@ -21,12 +21,8 @@ const router = express.Router(); const listAllowedFilters = [ 'name', 'handlingTime', - 'localPickup', - 'globalShipping', - 'freightShipping', - 'pickupDropOff', 'courierServices', - 'marketplaces.marketplace', + 'localPickup', 'createdAt', 'updatedAt', '_reference', @@ -35,9 +31,8 @@ const listAllowedSorters = ['name', 'handlingTime', 'createdAt', '_id', 'updated const propertiesAllowedFilters = [ 'name', 'handlingTime', - 'localPickup', 'courierServices', - 'marketplaces.marketplace', + 'localPickup', ]; router.get('/', isAuthenticated, checkPermissions('fulfillmentPolicy', 'list'), async (req, res) => { diff --git a/src/routes/sales/listings.js b/src/routes/sales/listings.js index 14131ad..766edd7 100644 --- a/src/routes/sales/listings.js +++ b/src/routes/sales/listings.js @@ -21,6 +21,7 @@ const listAllowedFilters = [ 'returnPolicy', 'state', 'state.type', + 'condition', 'createdAt', 'updatedAt', '_reference', @@ -48,6 +49,7 @@ const propertiesAllowedFilters = [ 'returnPolicy', 'state', 'state.type', + 'condition', 'createdAt', 'updatedAt', ]; diff --git a/src/routes/sales/returnpolicies.js b/src/routes/sales/returnpolicies.js index 5483880..3e70d30 100644 --- a/src/routes/sales/returnpolicies.js +++ b/src/routes/sales/returnpolicies.js @@ -24,7 +24,6 @@ const listAllowedFilters = [ 'returnPeriodDays', 'returnShippingCostPayer', 'refundMethod', - 'marketplaces.marketplace', 'createdAt', 'updatedAt', '_reference', @@ -42,7 +41,6 @@ const propertiesAllowedFilters = [ 'returnsAccepted', 'returnShippingCostPayer', 'refundMethod', - 'marketplaces.marketplace', ]; router.get('/', isAuthenticated, checkPermissions('returnPolicy', 'list'), async (req, res) => {