Compare commits
No commits in common. "bbec009337c4613512db13bd05320884fe04e25f" and "91eb22ac4932d755c1c6e60cd6606fd9098d4c45" have entirely different histories.
bbec009337
...
91eb22ac49
@ -24,7 +24,6 @@ const userSettingsSchema = new mongoose.Schema({
|
||||
collapseState: { type: Schema.Types.Mixed, default: () => ({}) },
|
||||
},
|
||||
pageLayout: { type: Schema.Types.Mixed, default: () => ({}) },
|
||||
appearance: { type: Schema.Types.Mixed, default: () => ({}) },
|
||||
|
||||
createdAt: {
|
||||
type: Date,
|
||||
|
||||
@ -13,7 +13,6 @@ const listAllowedFilters = [
|
||||
'name',
|
||||
'color',
|
||||
'cost',
|
||||
'overrideCost',
|
||||
'costWithTax',
|
||||
'createdAt',
|
||||
'updatedAt',
|
||||
@ -26,7 +25,6 @@ const listAllowedSorters = [
|
||||
'color',
|
||||
'cost',
|
||||
'costWithTax',
|
||||
'overrideCost',
|
||||
'createdAt',
|
||||
'updatedAt',
|
||||
];
|
||||
@ -48,33 +46,18 @@ import {
|
||||
router.get('/', isAuthenticated, checkPermissions('filamentSku', 'list'), async (req, res) => {
|
||||
const { page, limit, property, search, sortProperty, sortOrder } = req.query;
|
||||
const filter = await getFilter(req.query, listAllowedFilters);
|
||||
listFilamentSkusRouteHandler(
|
||||
req,
|
||||
res,
|
||||
page,
|
||||
limit,
|
||||
property,
|
||||
filter,
|
||||
search,
|
||||
getSort(sortProperty, listAllowedSorters),
|
||||
sortOrder
|
||||
);
|
||||
listFilamentSkusRouteHandler(req, res, page, limit, property, filter, search, getSort(sortProperty, listAllowedSorters), sortOrder);
|
||||
});
|
||||
|
||||
router.get(
|
||||
'/properties',
|
||||
checkPermissions('filamentSku', 'list'),
|
||||
isAuthenticated,
|
||||
async (req, res) => {
|
||||
let properties = convertPropertiesString(req.query.properties);
|
||||
const filter = await getFilter(req.query, propertiesAllowedFilters, false);
|
||||
let masterFilter = {};
|
||||
if (req.query.masterFilter) {
|
||||
masterFilter = JSON.parse(req.query.masterFilter);
|
||||
}
|
||||
listFilamentSkusByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||
router.get('/properties', checkPermissions('filamentSku', 'list'), isAuthenticated, async (req, res) => {
|
||||
let properties = convertPropertiesString(req.query.properties);
|
||||
const filter = await getFilter(req.query, propertiesAllowedFilters, false);
|
||||
let masterFilter = {};
|
||||
if (req.query.masterFilter) {
|
||||
masterFilter = JSON.parse(req.query.masterFilter);
|
||||
}
|
||||
);
|
||||
listFilamentSkusByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||
});
|
||||
|
||||
router.get(
|
||||
'/values',
|
||||
@ -85,29 +68,23 @@ router.get(
|
||||
const filter = await getFilter(req.query, listAllowedFilters, true);
|
||||
var masterFilter = {};
|
||||
if (req.query.masterFilter) {
|
||||
masterFilter = await getFilter(JSON.parse(req.query.masterFilter), listAllowedFilters, true);
|
||||
masterFilter = await getFilter(
|
||||
JSON.parse(req.query.masterFilter),
|
||||
listAllowedFilters,
|
||||
true
|
||||
);
|
||||
}
|
||||
getFilamentSkuPropertyValuesRouteHandler(req, res, property, filter, masterFilter);
|
||||
}
|
||||
);
|
||||
router.get(
|
||||
'/search',
|
||||
checkPermissions('filamentSku', 'list'),
|
||||
isAuthenticated,
|
||||
async (req, res) => {
|
||||
const { search } = req.query;
|
||||
searchFilamentSkusRouteHandler(req, res, search);
|
||||
}
|
||||
);
|
||||
router.get('/search', checkPermissions('filamentSku', 'list'), isAuthenticated, async (req, res) => {
|
||||
const { search } = req.query;
|
||||
searchFilamentSkusRouteHandler(req, res, search);
|
||||
});
|
||||
|
||||
router.post(
|
||||
'/',
|
||||
isAuthenticated,
|
||||
checkPermissions('filament', 'newFilamentSku'),
|
||||
async (req, res) => {
|
||||
newFilamentSkuRouteHandler(req, res);
|
||||
}
|
||||
);
|
||||
router.post('/', isAuthenticated, checkPermissions('filament', 'newFilamentSku'), async (req, res) => {
|
||||
newFilamentSkuRouteHandler(req, res);
|
||||
});
|
||||
|
||||
router.get('/stats', isAuthenticated, async (req, res) => {
|
||||
getFilamentSkuStatsRouteHandler(req, res);
|
||||
@ -120,16 +97,7 @@ router.get('/history', isAuthenticated, async (req, res) => {
|
||||
router.get('/neighbors', isAuthenticated, async (req, res) => {
|
||||
const { property, search, sortProperty, sortOrder, id } = req.query;
|
||||
const filter = await getFilter(req.query, listAllowedFilters);
|
||||
getFilamentSkuNeighborsRouteHandler(
|
||||
req,
|
||||
res,
|
||||
property,
|
||||
filter,
|
||||
search,
|
||||
getSort(sortProperty, listAllowedSorters),
|
||||
sortOrder,
|
||||
id
|
||||
);
|
||||
getFilamentSkuNeighborsRouteHandler(req, res, property, filter, search, getSort(sortProperty, listAllowedSorters), sortOrder, id);
|
||||
});
|
||||
|
||||
router.get('/:id', isAuthenticated, async (req, res) => {
|
||||
|
||||
@ -12,10 +12,8 @@ const listAllowedFilters = [
|
||||
'part._id',
|
||||
'name',
|
||||
'cost',
|
||||
'overrideCost',
|
||||
'costWithTax',
|
||||
'price',
|
||||
'overridePrice',
|
||||
'priceWithTax',
|
||||
'margin',
|
||||
'createdAt',
|
||||
@ -30,8 +28,6 @@ const listAllowedSorters = [
|
||||
'costWithTax',
|
||||
'price',
|
||||
'priceWithTax',
|
||||
'overrideCost',
|
||||
'overridePrice',
|
||||
'margin',
|
||||
'createdAt',
|
||||
'updatedAt',
|
||||
@ -48,54 +44,50 @@ import {
|
||||
getPartSkuHistoryRouteHandler,
|
||||
searchPartSkusRouteHandler,
|
||||
getPartSkuPropertyValuesRouteHandler,
|
||||
getPartSkuNeighborsRouteHandler,
|
||||
|
||||
getPartSkuNeighborsRouteHandler
|
||||
} from '../../services/management/partskus.js';
|
||||
|
||||
router.get('/', isAuthenticated, checkPermissions('partSku', 'list'), async (req, res) => {
|
||||
const { page, limit, property, search, sortProperty, sortOrder } = req.query;
|
||||
const filter = await getFilter(req.query, listAllowedFilters);
|
||||
listPartSkusRouteHandler(
|
||||
req,
|
||||
res,
|
||||
page,
|
||||
limit,
|
||||
property,
|
||||
filter,
|
||||
search,
|
||||
getSort(sortProperty, listAllowedSorters),
|
||||
sortOrder
|
||||
);
|
||||
const filter = await getFilter(req.query, listAllowedFilters);
|
||||
listPartSkusRouteHandler(req, res, page, limit, property, filter, search, getSort(sortProperty, listAllowedSorters), sortOrder);
|
||||
});
|
||||
|
||||
router.get('/properties', checkPermissions('partSku', 'list'), isAuthenticated, async (req, res) => {
|
||||
let properties = convertPropertiesString(req.query.properties);
|
||||
const filter = await getFilter(req.query, propertiesAllowedFilters, false);
|
||||
let masterFilter = {};
|
||||
if (req.query.masterFilter) {
|
||||
masterFilter = JSON.parse(req.query.masterFilter);
|
||||
}
|
||||
listPartSkusByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||
});
|
||||
|
||||
router.get(
|
||||
'/properties',
|
||||
'/values',
|
||||
checkPermissions('partSku', 'list'),
|
||||
isAuthenticated,
|
||||
async (req, res) => {
|
||||
let properties = convertPropertiesString(req.query.properties);
|
||||
const filter = await getFilter(req.query, propertiesAllowedFilters, false);
|
||||
let masterFilter = {};
|
||||
const { property } = req.query;
|
||||
const filter = await getFilter(req.query, listAllowedFilters, true);
|
||||
var masterFilter = {};
|
||||
if (req.query.masterFilter) {
|
||||
masterFilter = JSON.parse(req.query.masterFilter);
|
||||
masterFilter = await getFilter(
|
||||
JSON.parse(req.query.masterFilter),
|
||||
listAllowedFilters,
|
||||
true
|
||||
);
|
||||
}
|
||||
listPartSkusByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||
getPartSkuPropertyValuesRouteHandler(req, res, property, filter, masterFilter);
|
||||
}
|
||||
);
|
||||
|
||||
router.get('/values', checkPermissions('partSku', '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);
|
||||
}
|
||||
getPartSkuPropertyValuesRouteHandler(req, res, property, filter, masterFilter);
|
||||
});
|
||||
router.get('/search', checkPermissions('partSku', 'list'), isAuthenticated, async (req, res) => {
|
||||
const { search } = req.query;
|
||||
searchPartSkusRouteHandler(req, res, search);
|
||||
});
|
||||
|
||||
|
||||
router.post('/', isAuthenticated, checkPermissions('part', 'newPartSku'), async (req, res) => {
|
||||
newPartSkuRouteHandler(req, res);
|
||||
});
|
||||
@ -111,16 +103,7 @@ router.get('/history', isAuthenticated, async (req, res) => {
|
||||
router.get('/neighbors', isAuthenticated, async (req, res) => {
|
||||
const { property, search, sortProperty, sortOrder, id } = req.query;
|
||||
const filter = await getFilter(req.query, listAllowedFilters);
|
||||
getPartSkuNeighborsRouteHandler(
|
||||
req,
|
||||
res,
|
||||
property,
|
||||
filter,
|
||||
search,
|
||||
getSort(sortProperty, listAllowedSorters),
|
||||
sortOrder,
|
||||
id
|
||||
);
|
||||
getPartSkuNeighborsRouteHandler(req, res, property, filter, search, getSort(sortProperty, listAllowedSorters), sortOrder, id);
|
||||
});
|
||||
|
||||
router.get('/:id', isAuthenticated, async (req, res) => {
|
||||
|
||||
@ -12,8 +12,6 @@ const listAllowedFilters = [
|
||||
'product._id',
|
||||
'name',
|
||||
'cost',
|
||||
'overrideCost',
|
||||
'overridePrice',
|
||||
'costWithTax',
|
||||
'price',
|
||||
'priceWithTax',
|
||||
@ -28,8 +26,6 @@ const listAllowedSorters = [
|
||||
'name',
|
||||
'cost',
|
||||
'costWithTax',
|
||||
'overrideCost',
|
||||
'overridePrice',
|
||||
'price',
|
||||
'priceWithTax',
|
||||
'margin',
|
||||
@ -48,62 +44,53 @@ import {
|
||||
getProductSkuHistoryRouteHandler,
|
||||
searchProductSkusRouteHandler,
|
||||
getProductSkuPropertyValuesRouteHandler,
|
||||
getProductSkuNeighborsRouteHandler,
|
||||
|
||||
getProductSkuNeighborsRouteHandler
|
||||
} from '../../services/management/productskus.js';
|
||||
|
||||
router.get('/', isAuthenticated, checkPermissions('productSku', 'list'), async (req, res) => {
|
||||
const { page, limit, property, search, sortProperty, sortOrder } = req.query;
|
||||
const filter = await getFilter(req.query, listAllowedFilters);
|
||||
listProductSkusRouteHandler(
|
||||
req,
|
||||
res,
|
||||
page,
|
||||
limit,
|
||||
property,
|
||||
filter,
|
||||
search,
|
||||
getSort(sortProperty, listAllowedSorters),
|
||||
sortOrder
|
||||
);
|
||||
const filter = await getFilter(req.query, listAllowedFilters);
|
||||
listProductSkusRouteHandler(req, res, page, limit, property, filter, search, getSort(sortProperty, listAllowedSorters), sortOrder);
|
||||
});
|
||||
|
||||
router.get('/properties', checkPermissions('productSku', 'list'), isAuthenticated, async (req, res) => {
|
||||
let properties = convertPropertiesString(req.query.properties);
|
||||
const filter = await getFilter(req.query, propertiesAllowedFilters, false);
|
||||
let masterFilter = {};
|
||||
if (req.query.masterFilter) {
|
||||
masterFilter = JSON.parse(req.query.masterFilter);
|
||||
}
|
||||
listProductSkusByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||
});
|
||||
|
||||
router.get(
|
||||
'/properties',
|
||||
'/values',
|
||||
checkPermissions('productSku', 'list'),
|
||||
isAuthenticated,
|
||||
async (req, res) => {
|
||||
let properties = convertPropertiesString(req.query.properties);
|
||||
const filter = await getFilter(req.query, propertiesAllowedFilters, false);
|
||||
let masterFilter = {};
|
||||
const { property } = req.query;
|
||||
const filter = await getFilter(req.query, listAllowedFilters, true);
|
||||
var masterFilter = {};
|
||||
if (req.query.masterFilter) {
|
||||
masterFilter = JSON.parse(req.query.masterFilter);
|
||||
masterFilter = await getFilter(
|
||||
JSON.parse(req.query.masterFilter),
|
||||
listAllowedFilters,
|
||||
true
|
||||
);
|
||||
}
|
||||
listProductSkusByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
|
||||
getProductSkuPropertyValuesRouteHandler(req, res, property, filter, masterFilter);
|
||||
}
|
||||
);
|
||||
|
||||
router.get('/values', checkPermissions('productSku', '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);
|
||||
}
|
||||
getProductSkuPropertyValuesRouteHandler(req, res, property, filter, masterFilter);
|
||||
});
|
||||
router.get('/search', checkPermissions('productSku', 'list'), isAuthenticated, async (req, res) => {
|
||||
const { search } = req.query;
|
||||
searchProductSkusRouteHandler(req, res, search);
|
||||
});
|
||||
|
||||
router.post(
|
||||
'/',
|
||||
isAuthenticated,
|
||||
checkPermissions('product', 'newProductSku'),
|
||||
async (req, res) => {
|
||||
newProductSkuRouteHandler(req, res);
|
||||
}
|
||||
);
|
||||
|
||||
router.post('/', isAuthenticated, checkPermissions('product', 'newProductSku'), async (req, res) => {
|
||||
newProductSkuRouteHandler(req, res);
|
||||
});
|
||||
|
||||
router.get('/stats', isAuthenticated, async (req, res) => {
|
||||
getProductSkuStatsRouteHandler(req, res);
|
||||
@ -116,16 +103,7 @@ router.get('/history', isAuthenticated, async (req, res) => {
|
||||
router.get('/neighbors', isAuthenticated, async (req, res) => {
|
||||
const { property, search, sortProperty, sortOrder, id } = req.query;
|
||||
const filter = await getFilter(req.query, listAllowedFilters);
|
||||
getProductSkuNeighborsRouteHandler(
|
||||
req,
|
||||
res,
|
||||
property,
|
||||
filter,
|
||||
search,
|
||||
getSort(sortProperty, listAllowedSorters),
|
||||
sortOrder,
|
||||
id
|
||||
);
|
||||
getProductSkuNeighborsRouteHandler(req, res, property, filter, search, getSort(sortProperty, listAllowedSorters), sortOrder, id);
|
||||
});
|
||||
|
||||
router.get('/:id', isAuthenticated, async (req, res) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user