Added text indexes to various schemas for improved search capabilities across finance, inventory, and management modules. Updated route handlers to include search functionality for invoices, payments, tax records, and inventory items, enhancing data retrieval efficiency.
Some checks failed
farmcontrol/farmcontrol-api/pipeline/head There was a failure building this commit

This commit is contained in:
Tom Butcher 2026-07-04 16:48:50 +01:00
parent 710bfc6de6
commit 50eacb3974
132 changed files with 754 additions and 3 deletions

View File

@ -54,6 +54,8 @@ const invoiceSchema = new Schema(
{ timestamps: true } { timestamps: true }
); );
invoiceSchema.index({ orderType: 'text', fromType: 'text', toType: 'text' });
const rollupConfigs = [ const rollupConfigs = [
{ {
name: 'draft', name: 'draft',

View File

@ -24,6 +24,8 @@ const paymentSchema = new Schema(
{ timestamps: true } { timestamps: true }
); );
paymentSchema.index({ paymentMethod: 'text', notes: 'text' });
const rollupConfigs = [ const rollupConfigs = [
{ {
name: 'draft', name: 'draft',

View File

@ -19,6 +19,8 @@ const taxRecordSchema = new Schema(
{ timestamps: true } { timestamps: true }
); );
taxRecordSchema.index({ transactionType: 'text' });
taxRecordSchema.virtual('id').get(function () { taxRecordSchema.virtual('id').get(function () {
return this._id; return this._id;
}); });

View File

@ -49,6 +49,8 @@ const filamentStockSchema = new Schema(
{ timestamps: true } { timestamps: true }
); );
filamentStockSchema.index({ 'state.type': 'text' });
filamentStockSchema.pre('validate', async function () { filamentStockSchema.pre('validate', async function () {
if (!this.filament && this.filamentSku) { if (!this.filament && this.filamentSku) {
const sku = await mongoose const sku = await mongoose

View File

@ -69,6 +69,8 @@ const orderItemSchema = new Schema(
{ timestamps: true } { timestamps: true }
); );
orderItemSchema.index({ name: 'text', itemType: 'text', orderType: 'text' });
const rollupConfigs = [ const rollupConfigs = [
{ {
name: 'shipped', name: 'shipped',

View File

@ -43,6 +43,8 @@ const partStockSchema = new Schema(
{ timestamps: true } { timestamps: true }
); );
partStockSchema.index({ sourceType: 'text', 'state.type': 'text' });
const rollupConfigs = [ const rollupConfigs = [
{ {
name: 'totalCurrentQuantity', name: 'totalCurrentQuantity',

View File

@ -49,6 +49,8 @@ const productStockSchema = new Schema(
{ timestamps: true } { timestamps: true }
); );
productStockSchema.index({ 'state.type': 'text' });
const rollupConfigs = [ const rollupConfigs = [
{ {
name: 'totalCurrentQuantity', name: 'totalCurrentQuantity',

View File

@ -25,6 +25,8 @@ const purchaseOrderSchema = new Schema(
{ timestamps: true } { timestamps: true }
); );
purchaseOrderSchema.index({ 'state.type': 'text' });
const rollupConfigs = [ const rollupConfigs = [
{ {
name: 'draft', name: 'draft',

View File

@ -34,6 +34,8 @@ const shipmentSchema = new Schema(
{ timestamps: true } { timestamps: true }
); );
shipmentSchema.index({ trackingNumber: 'text', orderType: 'text' });
shipmentSchema.statics.recalculate = async function (shipment, user) { shipmentSchema.statics.recalculate = async function (shipment, user) {
if (shipment.orderType !== 'purchaseOrder' && shipment.orderType !== 'salesOrder') { if (shipment.orderType !== 'purchaseOrder' && shipment.orderType !== 'salesOrder') {
return; return;

View File

@ -28,6 +28,8 @@ const stockAuditSchema = new Schema(
{ timestamps: true } { timestamps: true }
); );
stockAuditSchema.index({ type: 'text', status: 'text', notes: 'text' });
// Add virtual id getter // Add virtual id getter
stockAuditSchema.virtual('id').get(function () { stockAuditSchema.virtual('id').get(function () {
return this._id; return this._id;

View File

@ -32,6 +32,8 @@ const stockEventSchema = new Schema(
{ timestamps: true } { timestamps: true }
); );
stockEventSchema.index({ parentType: 'text', ownerType: 'text', unit: 'text' });
// Add virtual id getter // Add virtual id getter
stockEventSchema.virtual('id').get(function () { stockEventSchema.virtual('id').get(function () {
return this._id; return this._id;

View File

@ -21,6 +21,8 @@ const stockLocationSchema = new Schema(
{ timestamps: true } { timestamps: true }
); );
stockLocationSchema.index({ name: 'text' });
stockLocationSchema.statics.stats = async function () { stockLocationSchema.statics.stats = async function () {
const total = await this.countDocuments({}); const total = await this.countDocuments({});
return { total: { count: total } }; return { total: { count: total } };

View File

@ -48,6 +48,8 @@ const stockTransferSchema = new Schema(
{ timestamps: true } { timestamps: true }
); );
stockTransferSchema.index({ name: 'text' });
stockTransferSchema.statics.stats = async function () { stockTransferSchema.statics.stats = async function () {
const [draft, posted] = await Promise.all([ const [draft, posted] = await Promise.all([
this.countDocuments({ 'state.type': 'draft' }), this.countDocuments({ 'state.type': 'draft' }),

View File

@ -13,6 +13,8 @@ const appPasswordSchema = new mongoose.Schema(
{ timestamps: true } { timestamps: true }
); );
appPasswordSchema.index({ name: 'text' });
appPasswordSchema.virtual('id').get(function () { appPasswordSchema.virtual('id').get(function () {
return this._id; return this._id;
}); });

View File

@ -36,6 +36,8 @@ const auditLogSchema = new Schema(
{ timestamps: true } { timestamps: true }
); );
auditLogSchema.index({ operation: 'text', parentType: 'text', ownerType: 'text' });
// Add virtual id getter // Add virtual id getter
auditLogSchema.virtual('id').get(function () { auditLogSchema.virtual('id').get(function () {
return this._id; return this._id;

View File

@ -14,6 +14,8 @@ const courierSchema = new mongoose.Schema(
{ timestamps: true } { timestamps: true }
); );
courierSchema.index({ name: 'text', website: 'text', email: 'text', phone: 'text', contact: 'text', country: 'text' });
courierSchema.virtual('id').get(function () { courierSchema.virtual('id').get(function () {
return this._id; return this._id;
}); });

View File

@ -15,6 +15,8 @@ const courierServiceSchema = new mongoose.Schema(
{ timestamps: true } { timestamps: true }
); );
courierServiceSchema.index({ name: 'text', website: 'text' });
courierServiceSchema.virtual('id').get(function () { courierServiceSchema.virtual('id').get(function () {
return this._id; return this._id;
}); });

View File

@ -39,6 +39,8 @@ const documentJobSchema = new Schema(
{ timestamps: true } { timestamps: true }
); );
documentJobSchema.index({ name: 'text', objectType: 'text' });
// Add virtual id getter // Add virtual id getter
documentJobSchema.virtual('id').get(function () { documentJobSchema.virtual('id').get(function () {
return this._id; return this._id;

View File

@ -38,6 +38,8 @@ const documentPrinterSchema = new Schema(
{ timestamps: true } { timestamps: true }
); );
documentPrinterSchema.index({ name: 'text', tags: 'text' });
// Add virtual id getter // Add virtual id getter
documentPrinterSchema.virtual('id').get(function () { documentPrinterSchema.virtual('id').get(function () {
return this._id; return this._id;

View File

@ -29,6 +29,8 @@ const documentSizeSchema = new Schema(
{ timestamps: true } { timestamps: true }
); );
documentSizeSchema.index({ name: 'text' });
// Add virtual id getter // Add virtual id getter
documentSizeSchema.virtual('id').get(function () { documentSizeSchema.virtual('id').get(function () {
return this._id; return this._id;

View File

@ -52,6 +52,8 @@ const documentTemplateSchema = new Schema(
{ timestamps: true } { timestamps: true }
); );
documentTemplateSchema.index({ name: 'text', tags: 'text', objectType: 'text' });
// Add virtual id getter // Add virtual id getter
documentTemplateSchema.virtual('id').get(function () { documentTemplateSchema.virtual('id').get(function () {
return this._id; return this._id;

View File

@ -18,6 +18,8 @@ const filamentSchema = new mongoose.Schema({
costWithTax: { type: Number, required: false }, costWithTax: { type: Number, required: false },
}, { timestamps: true }); }, { timestamps: true });
filamentSchema.index({ name: 'text', barcode: 'text', url: 'text' });
filamentSchema.virtual('id').get(function () { filamentSchema.virtual('id').get(function () {
return this._id; return this._id;
}); });

View File

@ -19,6 +19,8 @@ const filamentSkuSchema = new Schema(
{ timestamps: true } { timestamps: true }
); );
filamentSkuSchema.index({ name: 'text', barcode: 'text', description: 'text', color: 'text' });
// Add virtual id getter // Add virtual id getter
filamentSkuSchema.virtual('id').get(function () { filamentSkuSchema.virtual('id').get(function () {
return this._id; return this._id;

View File

@ -13,6 +13,8 @@ const fileSchema = new mongoose.Schema(
{ timestamps: true } { timestamps: true }
); );
fileSchema.index({ name: 'text', type: 'text', extension: 'text' });
fileSchema.virtual('id').get(function () { fileSchema.virtual('id').get(function () {
return this._id; return this._id;
}); });

View File

@ -63,6 +63,8 @@ const hostSchema = new mongoose.Schema(
{ timestamps: true } { timestamps: true }
); );
hostSchema.index({ name: 'text', tags: 'text' });
hostSchema.virtual('id').get(function () { hostSchema.virtual('id').get(function () {
return this._id; return this._id;
}); });

View File

@ -11,6 +11,8 @@ const materialSchema = new mongoose.Schema(
{ timestamps: true } { timestamps: true }
); );
materialSchema.index({ name: 'text', url: 'text', tags: 'text' });
materialSchema.virtual('id').get(function () { materialSchema.virtual('id').get(function () {
return this._id; return this._id;
}); });

View File

@ -23,6 +23,8 @@ const noteTypeSchema = new Schema(
{ timestamps: true } { timestamps: true }
); );
noteTypeSchema.index({ name: 'text' });
// Add virtual id getter // Add virtual id getter
noteTypeSchema.virtual('id').get(function () { noteTypeSchema.virtual('id').get(function () {
return this._id; return this._id;

View File

@ -21,6 +21,8 @@ const partSchema = new Schema(
{ timestamps: true } { timestamps: true }
); );
partSchema.index({ name: 'text' });
// Add virtual id getter // Add virtual id getter
partSchema.virtual('id').get(function () { partSchema.virtual('id').get(function () {
return this._id; return this._id;

View File

@ -25,6 +25,8 @@ const partSkuSchema = new Schema(
{ timestamps: true } { timestamps: true }
); );
partSkuSchema.index({ name: 'text', barcode: 'text', description: 'text' });
// Add virtual id getter // Add virtual id getter
partSkuSchema.virtual('id').get(function () { partSkuSchema.virtual('id').get(function () {
return this._id; return this._id;

View File

@ -23,6 +23,9 @@ const productSchema = new Schema(
}, },
{ timestamps: true } { timestamps: true }
); );
productSchema.index({ name: 'text', tags: 'text', version: 'text' });
// Add virtual id getter // Add virtual id getter
productSchema.virtual('id').get(function () { productSchema.virtual('id').get(function () {
return this._id; return this._id;

View File

@ -9,6 +9,8 @@ const productCategorySchema = new mongoose.Schema(
{ timestamps: true } { timestamps: true }
); );
productCategorySchema.index({ name: 'text' });
productCategorySchema.virtual('id').get(function () { productCategorySchema.virtual('id').get(function () {
return this._id; return this._id;
}); });

View File

@ -32,6 +32,8 @@ const productSkuSchema = new Schema(
{ timestamps: true } { timestamps: true }
); );
productSkuSchema.index({ name: 'text', barcode: 'text', description: 'text' });
// Add virtual id getter // Add virtual id getter
productSkuSchema.virtual('id').get(function () { productSkuSchema.virtual('id').get(function () {
return this._id; return this._id;

View File

@ -16,6 +16,8 @@ const taxRateSchema = new mongoose.Schema(
{ timestamps: true } { timestamps: true }
); );
taxRateSchema.index({ name: 'text', description: 'text', country: 'text' });
taxRateSchema.virtual('id').get(function () { taxRateSchema.virtual('id').get(function () {
return this._id; return this._id;
}); });

View File

@ -15,6 +15,8 @@ const userSchema = new mongoose.Schema(
{ timestamps: true } { timestamps: true }
); );
userSchema.index({ username: 'text', name: 'text', firstName: 'text', lastName: 'text', email: 'text' });
userSchema.virtual('id').get(function () { userSchema.virtual('id').get(function () {
return this._id; return this._id;
}); });

View File

@ -26,6 +26,8 @@ const vendorSchema = new mongoose.Schema(
{ timestamps: true } { timestamps: true }
); );
vendorSchema.index({ name: 'text', website: 'text', email: 'text', phone: 'text', contact: 'text', country: 'text' });
vendorSchema.virtual('id').get(function () { vendorSchema.virtual('id').get(function () {
return this._id; return this._id;
}); });

View File

@ -30,7 +30,7 @@ gcodeFileSchema.pre('validate', async function () {
} }
}); });
gcodeFileSchema.index({ name: 'text', brand: 'text' }); gcodeFileSchema.index({ name: 'text', gcodeFileName: 'text' });
gcodeFileSchema.virtual('id').get(function () { gcodeFileSchema.virtual('id').get(function () {
return this._id; return this._id;

View File

@ -32,6 +32,8 @@ const jobSchema = new mongoose.Schema(
{ timestamps: true } { timestamps: true }
); );
jobSchema.index({ 'state.type': 'text' });
const rollupConfigs = [ const rollupConfigs = [
{ {
name: 'queued', name: 'queued',

View File

@ -57,6 +57,8 @@ const printerSchema = new Schema(
{ timestamps: true } { timestamps: true }
); );
printerSchema.index({ name: 'text', tags: 'text', firmware: 'text' });
const rollupConfigs = [ const rollupConfigs = [
{ {
name: 'standby', name: 'standby',

View File

@ -43,6 +43,8 @@ const subJobSchema = new mongoose.Schema({
finishedAt: { required: false, type: Date, default: null }, finishedAt: { required: false, type: Date, default: null },
}); });
subJobSchema.index({ moonrakerJobId: 'text', 'state.type': 'text' });
subJobSchema.virtual('id').get(function () { subJobSchema.virtual('id').get(function () {
return this._id; return this._id;
}); });

View File

@ -26,6 +26,8 @@ const clientSchema = new mongoose.Schema(
{ timestamps: true } { timestamps: true }
); );
clientSchema.index({ name: 'text', email: 'text', phone: 'text', country: 'text', tags: 'text' });
clientSchema.virtual('id').get(function () { clientSchema.virtual('id').get(function () {
return this._id; return this._id;
}); });

View File

@ -26,6 +26,8 @@ const listingSchema = new Schema(
{ timestamps: true } { timestamps: true }
); );
listingSchema.index({ title: 'text', url: 'text' });
listingSchema.virtual('id').get(function () { listingSchema.virtual('id').get(function () {
return this._id; return this._id;
}); });

View File

@ -25,6 +25,8 @@ const listingVarientSchema = new Schema(
{ timestamps: true } { timestamps: true }
); );
listingVarientSchema.index({ currency: 'text', 'state.type': 'text' });
listingVarientSchema.virtual('id').get(function () { listingVarientSchema.virtual('id').get(function () {
return this._id; return this._id;
}); });

View File

@ -28,6 +28,8 @@ const marketplaceSchema = new mongoose.Schema(
{ timestamps: true } { timestamps: true }
); );
marketplaceSchema.index({ name: 'text', provider: 'text' });
marketplaceSchema.virtual('id').get(function () { marketplaceSchema.virtual('id').get(function () {
return this._id; return this._id;
}); });

View File

@ -30,6 +30,8 @@ const salesOrderSchema = new Schema(
{ timestamps: true } { timestamps: true }
); );
salesOrderSchema.index({ 'state.type': 'text' });
const rollupConfigs = [ const rollupConfigs = [
{ {
name: 'draft', name: 'draft',

View File

@ -16,6 +16,7 @@ import {
acknowledgeInvoiceRouteHandler, acknowledgeInvoiceRouteHandler,
cancelInvoiceRouteHandler, cancelInvoiceRouteHandler,
postInvoiceRouteHandler, postInvoiceRouteHandler,
searchInvoicesRouteHandler
} from '../../services/finance/invoices.js'; } from '../../services/finance/invoices.js';
// list of invoices // list of invoices
@ -54,6 +55,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
} }
listInvoicesByPropertiesRouteHandler(req, res, properties, filter, masterFilter); listInvoicesByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchInvoicesRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newInvoiceRouteHandler(req, res); newInvoiceRouteHandler(req, res);

View File

@ -17,6 +17,7 @@ import {
authorisePaymentRouteHandler, authorisePaymentRouteHandler,
declinePaymentRouteHandler, declinePaymentRouteHandler,
cancelPaymentRouteHandler, cancelPaymentRouteHandler,
searchPaymentsRouteHandler
} from '../../services/finance/payments.js'; } from '../../services/finance/payments.js';
// list of payments // list of payments
@ -54,6 +55,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
} }
listPaymentsByPropertiesRouteHandler(req, res, properties, filter, masterFilter); listPaymentsByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchPaymentsRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newPaymentRouteHandler(req, res); newPaymentRouteHandler(req, res);

View File

@ -12,6 +12,7 @@ import {
listTaxRecordsByPropertiesRouteHandler, listTaxRecordsByPropertiesRouteHandler,
getTaxRecordStatsRouteHandler, getTaxRecordStatsRouteHandler,
getTaxRecordHistoryRouteHandler, getTaxRecordHistoryRouteHandler,
searchTaxRecordsRouteHandler
} from '../../services/finance/taxrecords.js'; } from '../../services/finance/taxrecords.js';
// list of tax records // list of tax records
@ -28,6 +29,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
const filter = getFilter(req.query, allowedFilters, false); const filter = getFilter(req.query, allowedFilters, false);
listTaxRecordsByPropertiesRouteHandler(req, res, properties, filter); listTaxRecordsByPropertiesRouteHandler(req, res, properties, filter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchTaxRecordsRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newTaxRecordRouteHandler(req, res); newTaxRecordRouteHandler(req, res);

View File

@ -13,6 +13,7 @@ import {
listFilamentStocksByPropertiesRouteHandler, listFilamentStocksByPropertiesRouteHandler,
getFilamentStockStatsRouteHandler, getFilamentStockStatsRouteHandler,
getFilamentStockHistoryRouteHandler, getFilamentStockHistoryRouteHandler,
searchFilamentStocksRouteHandler
} from '../../services/inventory/filamentstocks.js'; } from '../../services/inventory/filamentstocks.js';
// list of filament stocks // list of filament stocks
@ -49,6 +50,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
} }
listFilamentStocksByPropertiesRouteHandler(req, res, properties, filter, masterFilter); listFilamentStocksByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchFilamentStocksRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newFilamentStockRouteHandler(req, res); newFilamentStockRouteHandler(req, res);

View File

@ -13,6 +13,7 @@ import {
listOrderItemsByPropertiesRouteHandler, listOrderItemsByPropertiesRouteHandler,
getOrderItemStatsRouteHandler, getOrderItemStatsRouteHandler,
getOrderItemHistoryRouteHandler, getOrderItemHistoryRouteHandler,
searchOrderItemsRouteHandler
} from '../../services/inventory/orderitems.js'; } from '../../services/inventory/orderitems.js';
// list of order items // list of order items
@ -53,6 +54,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
} }
listOrderItemsByPropertiesRouteHandler(req, res, properties, filter, masterFilter); listOrderItemsByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchOrderItemsRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newOrderItemRouteHandler(req, res); newOrderItemRouteHandler(req, res);

View File

@ -13,6 +13,7 @@ import {
listPartStocksByPropertiesRouteHandler, listPartStocksByPropertiesRouteHandler,
getPartStockStatsRouteHandler, getPartStockStatsRouteHandler,
getPartStockHistoryRouteHandler, getPartStockHistoryRouteHandler,
searchPartStocksRouteHandler
} from '../../services/inventory/partstocks.js'; } from '../../services/inventory/partstocks.js';
// list of part stocks // list of part stocks
@ -41,6 +42,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
} }
listPartStocksByPropertiesRouteHandler(req, res, properties, filter, masterFilter); listPartStocksByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchPartStocksRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newPartStockRouteHandler(req, res); newPartStockRouteHandler(req, res);

View File

@ -14,6 +14,7 @@ import {
listProductStocksByPropertiesRouteHandler, listProductStocksByPropertiesRouteHandler,
getProductStockStatsRouteHandler, getProductStockStatsRouteHandler,
getProductStockHistoryRouteHandler, getProductStockHistoryRouteHandler,
searchProductStocksRouteHandler
} from '../../services/inventory/productstocks.js'; } from '../../services/inventory/productstocks.js';
router.get('/', isAuthenticated, (req, res) => { router.get('/', isAuthenticated, (req, res) => {
@ -40,6 +41,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
} }
listProductStocksByPropertiesRouteHandler(req, res, properties, filter, masterFilter); listProductStocksByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchProductStocksRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newProductStockRouteHandler(req, res); newProductStockRouteHandler(req, res);

View File

@ -16,6 +16,7 @@ import {
postPurchaseOrderRouteHandler, postPurchaseOrderRouteHandler,
acknowledgePurchaseOrderRouteHandler, acknowledgePurchaseOrderRouteHandler,
cancelPurchaseOrderRouteHandler, cancelPurchaseOrderRouteHandler,
searchPurchaseOrdersRouteHandler
} from '../../services/inventory/purchaseorders.js'; } from '../../services/inventory/purchaseorders.js';
// list of purchase orders // list of purchase orders
@ -58,6 +59,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
} }
listPurchaseOrdersByPropertiesRouteHandler(req, res, properties, filter, masterFilter); listPurchaseOrdersByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchPurchaseOrdersRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newPurchaseOrderRouteHandler(req, res); newPurchaseOrderRouteHandler(req, res);

View File

@ -16,6 +16,7 @@ import {
shipShipmentRouteHandler, shipShipmentRouteHandler,
receiveShipmentRouteHandler, receiveShipmentRouteHandler,
cancelShipmentRouteHandler, cancelShipmentRouteHandler,
searchShipmentsRouteHandler
} from '../../services/inventory/shipments.js'; } from '../../services/inventory/shipments.js';
// list of shipments // list of shipments
@ -43,6 +44,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
} }
listShipmentsByPropertiesRouteHandler(req, res, properties, filter, masterFilter); listShipmentsByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchShipmentsRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newShipmentRouteHandler(req, res); newShipmentRouteHandler(req, res);

View File

@ -11,6 +11,7 @@ import {
deleteStockAuditRouteHandler, deleteStockAuditRouteHandler,
getStockAuditStatsRouteHandler, getStockAuditStatsRouteHandler,
getStockAuditHistoryRouteHandler, getStockAuditHistoryRouteHandler,
searchStockAuditsRouteHandler
} from '../../services/inventory/stockaudits.js'; } from '../../services/inventory/stockaudits.js';
// List stock audits // List stock audits
@ -39,6 +40,11 @@ router.post('/', isAuthenticated, (req, res) => {
}); });
// get stock audit stats // get stock audit stats
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchStockAuditsRouteHandler(req, res, search);
});
router.get('/stats', isAuthenticated, (req, res) => { router.get('/stats', isAuthenticated, (req, res) => {
getStockAuditStatsRouteHandler(req, res); getStockAuditStatsRouteHandler(req, res);
}); });

View File

@ -13,6 +13,7 @@ import {
listStockEventsByPropertiesRouteHandler, listStockEventsByPropertiesRouteHandler,
getStockEventStatsRouteHandler, getStockEventStatsRouteHandler,
getStockEventHistoryRouteHandler, getStockEventHistoryRouteHandler,
searchStockEventsRouteHandler
} from '../../services/inventory/stockevents.js'; } from '../../services/inventory/stockevents.js';
// list of stock events // list of stock events
@ -33,6 +34,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
} }
listStockEventsByPropertiesRouteHandler(req, res, properties, filter, masterFilter); listStockEventsByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchStockEventsRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newStockEventRouteHandler(req, res); newStockEventRouteHandler(req, res);

View File

@ -13,6 +13,7 @@ import {
listStockLocationsByPropertiesRouteHandler, listStockLocationsByPropertiesRouteHandler,
getStockLocationStatsRouteHandler, getStockLocationStatsRouteHandler,
getStockLocationHistoryRouteHandler, getStockLocationHistoryRouteHandler,
searchStockLocationsRouteHandler
} from '../../services/inventory/stocklocations.js'; } from '../../services/inventory/stocklocations.js';
router.get('/', isAuthenticated, (req, res) => { router.get('/', isAuthenticated, (req, res) => {
@ -32,6 +33,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
} }
listStockLocationsByPropertiesRouteHandler(req, res, properties, filter, masterFilter); listStockLocationsByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchStockLocationsRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newStockLocationRouteHandler(req, res); newStockLocationRouteHandler(req, res);

View File

@ -14,6 +14,7 @@ import {
listStockTransfersByPropertiesRouteHandler, listStockTransfersByPropertiesRouteHandler,
getStockTransferStatsRouteHandler, getStockTransferStatsRouteHandler,
getStockTransferHistoryRouteHandler, getStockTransferHistoryRouteHandler,
searchStockTransfersRouteHandler
} from '../../services/inventory/stocktransfers.js'; } from '../../services/inventory/stocktransfers.js';
router.get('/', isAuthenticated, (req, res) => { router.get('/', isAuthenticated, (req, res) => {
@ -33,6 +34,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
} }
listStockTransfersByPropertiesRouteHandler(req, res, properties, filter, masterFilter); listStockTransfersByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchStockTransfersRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newStockTransferRouteHandler(req, res); newStockTransferRouteHandler(req, res);

View File

@ -13,6 +13,7 @@ import {
getAppPasswordStatsRouteHandler, getAppPasswordStatsRouteHandler,
getAppPasswordHistoryRouteHandler, getAppPasswordHistoryRouteHandler,
regenerateSecretRouteHandler, regenerateSecretRouteHandler,
searchAppPasswordsRouteHandler
} from '../../services/management/apppasswords.js'; } from '../../services/management/apppasswords.js';
router.get('/', isAuthenticated, (req, res) => { router.get('/', isAuthenticated, (req, res) => {
@ -29,6 +30,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
const masterFilter = req.query.masterFilter ? JSON.parse(req.query.masterFilter) : {}; const masterFilter = req.query.masterFilter ? JSON.parse(req.query.masterFilter) : {};
listAppPasswordsByPropertiesRouteHandler(req, res, properties, filter, masterFilter); listAppPasswordsByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchAppPasswordsRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newAppPasswordRouteHandler(req, res); newAppPasswordRouteHandler(req, res);

View File

@ -5,6 +5,7 @@ import {
getAuditLogRouteHandler, getAuditLogRouteHandler,
getAuditLogStatsRouteHandler, getAuditLogStatsRouteHandler,
getAuditLogHistoryRouteHandler, getAuditLogHistoryRouteHandler,
searchAuditLogsRouteHandler
} from '../../services/management/auditlogs.js'; } from '../../services/management/auditlogs.js';
import { parseFilter } from '../../utils.js'; import { parseFilter } from '../../utils.js';
@ -30,6 +31,11 @@ router.get('/', isAuthenticated, async (req, res) => {
}); });
// get audit log stats // get audit log stats
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchAuditLogsRouteHandler(req, res, search);
});
router.get('/stats', isAuthenticated, (req, res) => { router.get('/stats', isAuthenticated, (req, res) => {
getAuditLogStatsRouteHandler(req, res); getAuditLogStatsRouteHandler(req, res);
}); });

View File

@ -12,6 +12,7 @@ import {
listCouriersByPropertiesRouteHandler, listCouriersByPropertiesRouteHandler,
getCourierStatsRouteHandler, getCourierStatsRouteHandler,
getCourierHistoryRouteHandler, getCourierHistoryRouteHandler,
searchCouriersRouteHandler
} from '../../services/management/courier.js'; } from '../../services/management/courier.js';
// list of couriers // list of couriers
@ -28,6 +29,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
const filter = getFilter(req.query, allowedFilters, false); const filter = getFilter(req.query, allowedFilters, false);
listCouriersByPropertiesRouteHandler(req, res, properties, filter); listCouriersByPropertiesRouteHandler(req, res, properties, filter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchCouriersRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newCourierRouteHandler(req, res); newCourierRouteHandler(req, res);

View File

@ -12,6 +12,7 @@ import {
listCourierServicesByPropertiesRouteHandler, listCourierServicesByPropertiesRouteHandler,
getCourierServiceStatsRouteHandler, getCourierServiceStatsRouteHandler,
getCourierServiceHistoryRouteHandler, getCourierServiceHistoryRouteHandler,
searchCourierServicesRouteHandler
} from '../../services/management/courierservice.js'; } from '../../services/management/courierservice.js';
// list of courier services // list of courier services
@ -28,6 +29,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
const filter = getFilter(req.query, allowedFilters, false); const filter = getFilter(req.query, allowedFilters, false);
listCourierServicesByPropertiesRouteHandler(req, res, properties, filter); listCourierServicesByPropertiesRouteHandler(req, res, properties, filter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchCourierServicesRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newCourierServiceRouteHandler(req, res); newCourierServiceRouteHandler(req, res);

View File

@ -12,6 +12,7 @@ import {
listDocumentJobsByPropertiesRouteHandler, listDocumentJobsByPropertiesRouteHandler,
getDocumentJobStatsRouteHandler, getDocumentJobStatsRouteHandler,
getDocumentJobHistoryRouteHandler, getDocumentJobHistoryRouteHandler,
searchDocumentJobsRouteHandler
} from '../../services/management/documentjobs.js'; } from '../../services/management/documentjobs.js';
// list of document jobs // list of document jobs
@ -28,6 +29,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
const filter = getFilter(req.query, allowedFilters, false); const filter = getFilter(req.query, allowedFilters, false);
listDocumentJobsByPropertiesRouteHandler(req, res, properties, filter); listDocumentJobsByPropertiesRouteHandler(req, res, properties, filter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchDocumentJobsRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newDocumentJobRouteHandler(req, res); newDocumentJobRouteHandler(req, res);

View File

@ -12,6 +12,7 @@ import {
listDocumentPrintersByPropertiesRouteHandler, listDocumentPrintersByPropertiesRouteHandler,
getDocumentPrinterStatsRouteHandler, getDocumentPrinterStatsRouteHandler,
getDocumentPrinterHistoryRouteHandler, getDocumentPrinterHistoryRouteHandler,
searchDocumentPrintersRouteHandler
} from '../../services/management/documentprinters.js'; } from '../../services/management/documentprinters.js';
// list of document printers // list of document printers
@ -28,6 +29,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
const filter = getFilter(req.query, allowedFilters, false); const filter = getFilter(req.query, allowedFilters, false);
listDocumentPrintersByPropertiesRouteHandler(req, res, properties, filter); listDocumentPrintersByPropertiesRouteHandler(req, res, properties, filter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchDocumentPrintersRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newDocumentPrinterRouteHandler(req, res); newDocumentPrinterRouteHandler(req, res);

View File

@ -12,6 +12,7 @@ import {
listDocumentSizesByPropertiesRouteHandler, listDocumentSizesByPropertiesRouteHandler,
getDocumentSizeStatsRouteHandler, getDocumentSizeStatsRouteHandler,
getDocumentSizeHistoryRouteHandler, getDocumentSizeHistoryRouteHandler,
searchDocumentSizesRouteHandler
} from '../../services/management/documentsizes.js'; } from '../../services/management/documentsizes.js';
// list of document sizes // list of document sizes
@ -28,6 +29,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
const filter = getFilter(req.query, allowedFilters, false); const filter = getFilter(req.query, allowedFilters, false);
listDocumentSizesByPropertiesRouteHandler(req, res, properties, filter); listDocumentSizesByPropertiesRouteHandler(req, res, properties, filter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchDocumentSizesRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newDocumentSizeRouteHandler(req, res); newDocumentSizeRouteHandler(req, res);

View File

@ -12,6 +12,7 @@ import {
listDocumentTemplatesByPropertiesRouteHandler, listDocumentTemplatesByPropertiesRouteHandler,
getDocumentTemplateStatsRouteHandler, getDocumentTemplateStatsRouteHandler,
getDocumentTemplateHistoryRouteHandler, getDocumentTemplateHistoryRouteHandler,
searchDocumentTemplatesRouteHandler
} from '../../services/management/documenttemplates.js'; } from '../../services/management/documenttemplates.js';
// list of document templates // list of document templates
@ -32,6 +33,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
} }
listDocumentTemplatesByPropertiesRouteHandler(req, res, properties, filter, masterFilter); listDocumentTemplatesByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchDocumentTemplatesRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newDocumentTemplateRouteHandler(req, res); newDocumentTemplateRouteHandler(req, res);

View File

@ -13,6 +13,7 @@ import {
deleteFilamentRouteHandler, deleteFilamentRouteHandler,
getFilamentStatsRouteHandler, getFilamentStatsRouteHandler,
getFilamentHistoryRouteHandler, getFilamentHistoryRouteHandler,
searchFilamentsRouteHandler
} from '../../services/management/filaments.js'; } from '../../services/management/filaments.js';
// list of filaments // list of filaments
@ -47,6 +48,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
const filter = getFilter(req.query, allowedFilters, false); const filter = getFilter(req.query, allowedFilters, false);
listFilamentsByPropertiesRouteHandler(req, res, properties, filter); listFilamentsByPropertiesRouteHandler(req, res, properties, filter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchFilamentsRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newFilamentRouteHandler(req, res); newFilamentRouteHandler(req, res);

View File

@ -12,6 +12,7 @@ import {
listFilamentSkusByPropertiesRouteHandler, listFilamentSkusByPropertiesRouteHandler,
getFilamentSkuStatsRouteHandler, getFilamentSkuStatsRouteHandler,
getFilamentSkuHistoryRouteHandler, getFilamentSkuHistoryRouteHandler,
searchFilamentSkusRouteHandler
} from '../../services/management/filamentskus.js'; } from '../../services/management/filamentskus.js';
router.get('/', isAuthenticated, (req, res) => { router.get('/', isAuthenticated, (req, res) => {
@ -31,6 +32,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
} }
listFilamentSkusByPropertiesRouteHandler(req, res, properties, filter, masterFilter); listFilamentSkusByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchFilamentSkusRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newFilamentSkuRouteHandler(req, res); newFilamentSkuRouteHandler(req, res);

View File

@ -14,6 +14,7 @@ import {
listFilesByPropertiesRouteHandler, listFilesByPropertiesRouteHandler,
getFileStatsRouteHandler, getFileStatsRouteHandler,
getFileHistoryRouteHandler, getFileHistoryRouteHandler,
searchFilesRouteHandler
} from '../../services/management/files.js'; } from '../../services/management/files.js';
// list of files // list of files
@ -30,6 +31,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
const filter = getFilter(req.query, allowedFilters, false); const filter = getFilter(req.query, allowedFilters, false);
listFilesByPropertiesRouteHandler(req, res, properties, filter); listFilesByPropertiesRouteHandler(req, res, properties, filter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchFilesRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newFileRouteHandler(req, res); newFileRouteHandler(req, res);

View File

@ -12,6 +12,7 @@ import {
listHostsByPropertiesRouteHandler, listHostsByPropertiesRouteHandler,
getHostStatsRouteHandler, getHostStatsRouteHandler,
getHostHistoryRouteHandler, getHostHistoryRouteHandler,
searchHostsRouteHandler
} from '../../services/management/hosts.js'; } from '../../services/management/hosts.js';
// list of hosts // list of hosts
@ -28,6 +29,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
const filter = getFilter(req.query, allowedFilters, false); const filter = getFilter(req.query, allowedFilters, false);
listHostsByPropertiesRouteHandler(req, res, properties, filter); listHostsByPropertiesRouteHandler(req, res, properties, filter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchHostsRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newHostRouteHandler(req, res); newHostRouteHandler(req, res);

View File

@ -11,6 +11,7 @@ import {
newMaterialRouteHandler, newMaterialRouteHandler,
getMaterialStatsRouteHandler, getMaterialStatsRouteHandler,
getMaterialHistoryRouteHandler, getMaterialHistoryRouteHandler,
searchMaterialsRouteHandler,
} from '../../services/management/materials.js'; } from '../../services/management/materials.js';
// list of materials // list of materials
@ -37,6 +38,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
listMaterialsByPropertiesRouteHandler(req, res, properties, filter); listMaterialsByPropertiesRouteHandler(req, res, properties, filter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchMaterialsRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newMaterialRouteHandler(req, res); newMaterialRouteHandler(req, res);
}); });

View File

@ -12,6 +12,7 @@ import {
listNoteTypesByPropertiesRouteHandler, listNoteTypesByPropertiesRouteHandler,
getNoteTypeStatsRouteHandler, getNoteTypeStatsRouteHandler,
getNoteTypeHistoryRouteHandler, getNoteTypeHistoryRouteHandler,
searchNoteTypesRouteHandler
} from '../../services/management/notetypes.js'; } from '../../services/management/notetypes.js';
// list of note types // list of note types
@ -32,6 +33,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
} }
listNoteTypesByPropertiesRouteHandler(req, res, properties, filter, masterFilter); listNoteTypesByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchNoteTypesRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newNoteTypeRouteHandler(req, res); newNoteTypeRouteHandler(req, res);

View File

@ -12,6 +12,7 @@ import {
listPartsByPropertiesRouteHandler, listPartsByPropertiesRouteHandler,
getPartStatsRouteHandler, getPartStatsRouteHandler,
getPartHistoryRouteHandler, getPartHistoryRouteHandler,
searchPartsRouteHandler
} from '../../services/management/parts.js'; } from '../../services/management/parts.js';
// list of parts // list of parts
@ -28,6 +29,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
const filter = getFilter(req.query, allowedFilters, false); const filter = getFilter(req.query, allowedFilters, false);
listPartsByPropertiesRouteHandler(req, res, properties, filter); listPartsByPropertiesRouteHandler(req, res, properties, filter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchPartsRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newPartRouteHandler(req, res); newPartRouteHandler(req, res);

View File

@ -12,6 +12,7 @@ import {
listPartSkusByPropertiesRouteHandler, listPartSkusByPropertiesRouteHandler,
getPartSkuStatsRouteHandler, getPartSkuStatsRouteHandler,
getPartSkuHistoryRouteHandler, getPartSkuHistoryRouteHandler,
searchPartSkusRouteHandler
} from '../../services/management/partskus.js'; } from '../../services/management/partskus.js';
router.get('/', isAuthenticated, (req, res) => { router.get('/', isAuthenticated, (req, res) => {
@ -31,6 +32,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
} }
listPartSkusByPropertiesRouteHandler(req, res, properties, filter, masterFilter); listPartSkusByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchPartSkusRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newPartSkuRouteHandler(req, res); newPartSkuRouteHandler(req, res);

View File

@ -10,6 +10,7 @@ import {
listProductCategoriesByPropertiesRouteHandler, listProductCategoriesByPropertiesRouteHandler,
listProductCategoriesRouteHandler, listProductCategoriesRouteHandler,
newProductCategoryRouteHandler, newProductCategoryRouteHandler,
searchProductCategoriesRouteHandler
} from '../../services/management/productcategories.js'; } from '../../services/management/productcategories.js';
const router = express.Router(); const router = express.Router();
@ -27,6 +28,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
const filter = getFilter(req.query, allowedFilters, false); const filter = getFilter(req.query, allowedFilters, false);
listProductCategoriesByPropertiesRouteHandler(req, res, properties, filter); listProductCategoriesByPropertiesRouteHandler(req, res, properties, filter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchProductCategoriesRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newProductCategoryRouteHandler(req, res); newProductCategoryRouteHandler(req, res);

View File

@ -12,6 +12,7 @@ import {
listProductsByPropertiesRouteHandler, listProductsByPropertiesRouteHandler,
getProductStatsRouteHandler, getProductStatsRouteHandler,
getProductHistoryRouteHandler, getProductHistoryRouteHandler,
searchProductsRouteHandler
} from '../../services/management/products.js'; } from '../../services/management/products.js';
// list of products // list of products
@ -28,6 +29,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
const filter = getFilter(req.query, allowedFilters, false); const filter = getFilter(req.query, allowedFilters, false);
listProductsByPropertiesRouteHandler(req, res, properties, filter); listProductsByPropertiesRouteHandler(req, res, properties, filter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchProductsRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newProductRouteHandler(req, res); newProductRouteHandler(req, res);

View File

@ -12,6 +12,7 @@ import {
listProductSkusByPropertiesRouteHandler, listProductSkusByPropertiesRouteHandler,
getProductSkuStatsRouteHandler, getProductSkuStatsRouteHandler,
getProductSkuHistoryRouteHandler, getProductSkuHistoryRouteHandler,
searchProductSkusRouteHandler
} from '../../services/management/productskus.js'; } from '../../services/management/productskus.js';
router.get('/', isAuthenticated, (req, res) => { router.get('/', isAuthenticated, (req, res) => {
@ -31,6 +32,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
} }
listProductSkusByPropertiesRouteHandler(req, res, properties, filter, masterFilter); listProductSkusByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchProductSkusRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newProductSkuRouteHandler(req, res); newProductSkuRouteHandler(req, res);

View File

@ -12,6 +12,7 @@ import {
listTaxRatesByPropertiesRouteHandler, listTaxRatesByPropertiesRouteHandler,
getTaxRateStatsRouteHandler, getTaxRateStatsRouteHandler,
getTaxRateHistoryRouteHandler, getTaxRateHistoryRouteHandler,
searchTaxRatesRouteHandler
} from '../../services/management/taxrates.js'; } from '../../services/management/taxrates.js';
// list of tax rates // list of tax rates
@ -28,6 +29,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
const filter = getFilter(req.query, allowedFilters, false); const filter = getFilter(req.query, allowedFilters, false);
listTaxRatesByPropertiesRouteHandler(req, res, properties, filter); listTaxRatesByPropertiesRouteHandler(req, res, properties, filter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchTaxRatesRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newTaxRateRouteHandler(req, res); newTaxRateRouteHandler(req, res);

View File

@ -11,6 +11,7 @@ import {
getUserStatsRouteHandler, getUserStatsRouteHandler,
getUserHistoryRouteHandler, getUserHistoryRouteHandler,
setAppPasswordRouteHandler, setAppPasswordRouteHandler,
searchUsersRouteHandler
} from '../../services/management/users.js'; } from '../../services/management/users.js';
// list of document templates // list of document templates
@ -31,6 +32,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
} }
listUsersByPropertiesRouteHandler(req, res, properties, filter, masterFilter); listUsersByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchUsersRouteHandler(req, res, search);
});
// get user stats // get user stats
router.get('/stats', isAuthenticated, (req, res) => { router.get('/stats', isAuthenticated, (req, res) => {

View File

@ -12,6 +12,7 @@ import {
listVendorsByPropertiesRouteHandler, listVendorsByPropertiesRouteHandler,
getVendorStatsRouteHandler, getVendorStatsRouteHandler,
getVendorHistoryRouteHandler, getVendorHistoryRouteHandler,
searchVendorsRouteHandler
} from '../../services/management/vendors.js'; } from '../../services/management/vendors.js';
// list of vendors // list of vendors
@ -28,6 +29,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
const filter = getFilter(req.query, allowedFilters, false); const filter = getFilter(req.query, allowedFilters, false);
listVendorsByPropertiesRouteHandler(req, res, properties, filter); listVendorsByPropertiesRouteHandler(req, res, properties, filter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchVendorsRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newVendorRouteHandler(req, res); newVendorRouteHandler(req, res);

View File

@ -10,6 +10,7 @@ import {
listGCodeFilesByPropertiesRouteHandler, listGCodeFilesByPropertiesRouteHandler,
getGCodeFileContentRouteHandler, getGCodeFileContentRouteHandler,
getGCodeFileStatsRouteHandler, getGCodeFileStatsRouteHandler,
searchGCodeFilesRouteHandler
} from '../../services/production/gcodefiles.js'; } from '../../services/production/gcodefiles.js';
import { convertPropertiesString, getFilter } from '../../utils.js'; import { convertPropertiesString, getFilter } from '../../utils.js';
@ -27,6 +28,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
const filter = getFilter(req.query, allowedFilters, false); const filter = getFilter(req.query, allowedFilters, false);
listGCodeFilesByPropertiesRouteHandler(req, res, properties, filter); listGCodeFilesByPropertiesRouteHandler(req, res, properties, filter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchGCodeFilesRouteHandler(req, res, search);
});
// create new gcodeFile // create new gcodeFile
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {

View File

@ -10,6 +10,7 @@ import {
deleteJobRouteHandler, deleteJobRouteHandler,
getJobStatsRouteHandler, getJobStatsRouteHandler,
getJobHistoryRouteHandler, getJobHistoryRouteHandler,
searchJobsRouteHandler
} from '../../services/production/jobs.js'; } from '../../services/production/jobs.js';
import { convertPropertiesString, getFilter } from '../../utils.js'; import { convertPropertiesString, getFilter } from '../../utils.js';
@ -27,6 +28,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
const filter = getFilter(req.query, allowedFilters, false); const filter = getFilter(req.query, allowedFilters, false);
listJobsByPropertiesRouteHandler(req, res, properties, filter); listJobsByPropertiesRouteHandler(req, res, properties, filter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchJobsRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newJobRouteHandler(req, res); newJobRouteHandler(req, res);

View File

@ -10,6 +10,7 @@ import {
getPrinterStatsRouteHandler, getPrinterStatsRouteHandler,
listPrintersByPropertiesRouteHandler, listPrintersByPropertiesRouteHandler,
getPrinterHistoryRouteHandler, getPrinterHistoryRouteHandler,
searchPrintersRouteHandler
} from '../../services/production/printers.js'; } from '../../services/production/printers.js';
import { convertPropertiesString, getFilter } from '../../utils.js'; import { convertPropertiesString, getFilter } from '../../utils.js';
@ -27,6 +28,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
const filter = getFilter(req.query, allowedFilters, false); const filter = getFilter(req.query, allowedFilters, false);
listPrintersByPropertiesRouteHandler(req, res, properties, filter); listPrintersByPropertiesRouteHandler(req, res, properties, filter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchPrintersRouteHandler(req, res, search);
});
// create new printer // create new printer
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {

View File

@ -8,6 +8,7 @@ import {
getSubJobRouteHandler, getSubJobRouteHandler,
getSubJobStatsRouteHandler, getSubJobStatsRouteHandler,
getSubJobHistoryRouteHandler, getSubJobHistoryRouteHandler,
searchSubJobsRouteHandler
} from '../../services/production/subjobs.js'; } from '../../services/production/subjobs.js';
import { getFilter, convertPropertiesString } from '../../utils.js'; import { getFilter, convertPropertiesString } from '../../utils.js';
@ -25,6 +26,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
const filter = getFilter(req.query, allowedFilters, false); const filter = getFilter(req.query, allowedFilters, false);
listSubJobsByPropertiesRouteHandler(req, res, properties, filter); listSubJobsByPropertiesRouteHandler(req, res, properties, filter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchSubJobsRouteHandler(req, res, search);
});
// get sub job stats // get sub job stats
router.get('/stats', isAuthenticated, (req, res) => { router.get('/stats', isAuthenticated, (req, res) => {

View File

@ -12,6 +12,7 @@ import {
listClientsByPropertiesRouteHandler, listClientsByPropertiesRouteHandler,
getClientStatsRouteHandler, getClientStatsRouteHandler,
getClientHistoryRouteHandler, getClientHistoryRouteHandler,
searchClientsRouteHandler
} from '../../services/sales/clients.js'; } from '../../services/sales/clients.js';
// list of clients // list of clients
@ -28,6 +29,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
const filter = getFilter(req.query, allowedFilters, false); const filter = getFilter(req.query, allowedFilters, false);
listClientsByPropertiesRouteHandler(req, res, properties, filter); listClientsByPropertiesRouteHandler(req, res, properties, filter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchClientsRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newClientRouteHandler(req, res); newClientRouteHandler(req, res);

View File

@ -14,6 +14,7 @@ import {
getListingHistoryRouteHandler, getListingHistoryRouteHandler,
publishListingRouteHandler, publishListingRouteHandler,
unpublishListingRouteHandler, unpublishListingRouteHandler,
searchListingsRouteHandler
} from '../../services/sales/listings.js'; } from '../../services/sales/listings.js';
router.get('/', isAuthenticated, (req, res) => { router.get('/', isAuthenticated, (req, res) => {
@ -47,6 +48,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
const filter = getFilter(req.query, allowedFilters, false); const filter = getFilter(req.query, allowedFilters, false);
listListingsByPropertiesRouteHandler(req, res, properties, filter); listListingsByPropertiesRouteHandler(req, res, properties, filter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchListingsRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newListingRouteHandler(req, res); newListingRouteHandler(req, res);

View File

@ -14,6 +14,7 @@ import {
getListingVarientHistoryRouteHandler, getListingVarientHistoryRouteHandler,
publishListingVarientRouteHandler, publishListingVarientRouteHandler,
unpublishListingVarientRouteHandler, unpublishListingVarientRouteHandler,
searchListingVarientsRouteHandler
} from '../../services/sales/listingvarients.js'; } from '../../services/sales/listingvarients.js';
router.get('/', isAuthenticated, (req, res) => { router.get('/', isAuthenticated, (req, res) => {
@ -47,6 +48,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
const filter = getFilter(req.query, allowedFilters, false); const filter = getFilter(req.query, allowedFilters, false);
listListingVarientsByPropertiesRouteHandler(req, res, properties, filter); listListingVarientsByPropertiesRouteHandler(req, res, properties, filter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchListingVarientsRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newListingVarientRouteHandler(req, res); newListingVarientRouteHandler(req, res);

View File

@ -18,6 +18,7 @@ import {
syncMarketplaceItemsRouteHandler, syncMarketplaceItemsRouteHandler,
syncMarketplaceOrdersRouteHandler, syncMarketplaceOrdersRouteHandler,
marketplaceWebhookRouteHandler, marketplaceWebhookRouteHandler,
searchMarketplacesRouteHandler
} from '../../services/sales/marketplaces.js'; } from '../../services/sales/marketplaces.js';
router.get('/', isAuthenticated, (req, res) => { router.get('/', isAuthenticated, (req, res) => {
@ -33,6 +34,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
const filter = getFilter(req.query, allowedFilters, false); const filter = getFilter(req.query, allowedFilters, false);
listMarketplacesByPropertiesRouteHandler(req, res, properties, filter); listMarketplacesByPropertiesRouteHandler(req, res, properties, filter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchMarketplacesRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newMarketplaceRouteHandler(req, res); newMarketplaceRouteHandler(req, res);

View File

@ -16,6 +16,7 @@ import {
postSalesOrderRouteHandler, postSalesOrderRouteHandler,
confirmSalesOrderRouteHandler, confirmSalesOrderRouteHandler,
cancelSalesOrderRouteHandler, cancelSalesOrderRouteHandler,
searchSalesOrdersRouteHandler
} from '../../services/sales/salesorders.js'; } from '../../services/sales/salesorders.js';
// list of sales orders // list of sales orders
@ -36,6 +37,11 @@ router.get('/properties', isAuthenticated, (req, res) => {
} }
listSalesOrdersByPropertiesRouteHandler(req, res, properties, filter, masterFilter); listSalesOrdersByPropertiesRouteHandler(req, res, properties, filter, masterFilter);
}); });
router.get('/search', isAuthenticated, (req, res) => {
const { search } = req.query;
searchSalesOrdersRouteHandler(req, res, search);
});
router.post('/', isAuthenticated, (req, res) => { router.post('/', isAuthenticated, (req, res) => {
newSalesOrderRouteHandler(req, res); newSalesOrderRouteHandler(req, res);

View File

@ -13,6 +13,7 @@ import {
getModelStats, getModelStats,
getModelHistory, getModelHistory,
checkStates, checkStates,
searchObjects
} from '../../database/database.js'; } from '../../database/database.js';
import { orderItemModel } from '../../database/schemas/inventory/orderitem.schema.js'; import { orderItemModel } from '../../database/schemas/inventory/orderitem.schema.js';
import { shipmentModel } from '../../database/schemas/inventory/shipment.schema.js'; import { shipmentModel } from '../../database/schemas/inventory/shipment.schema.js';
@ -82,6 +83,14 @@ export const listInvoicesByPropertiesRouteHandler = async (
res.send(result); res.send(result);
}; };
export const searchInvoicesRouteHandler = async (req, res, search) => {
const result = await searchObjects({
model: invoiceModel,
search,
});
res.send(result);
};
export const getInvoiceRouteHandler = async (req, res) => { export const getInvoiceRouteHandler = async (req, res) => {
const id = req.params.id; const id = req.params.id;
const populateFields = [ const populateFields = [

View File

@ -13,6 +13,7 @@ import {
getModelStats, getModelStats,
getModelHistory, getModelHistory,
checkStates, checkStates,
searchObjects
} from '../../database/database.js'; } from '../../database/database.js';
import { invoiceModel } from '../../database/schemas/finance/invoice.schema.js'; import { invoiceModel } from '../../database/schemas/finance/invoice.schema.js';
@ -79,6 +80,14 @@ export const listPaymentsByPropertiesRouteHandler = async (
res.send(result); res.send(result);
}; };
export const searchPaymentsRouteHandler = async (req, res, search) => {
const result = await searchObjects({
model: paymentModel,
search,
});
res.send(result);
};
export const getPaymentRouteHandler = async (req, res) => { export const getPaymentRouteHandler = async (req, res) => {
const id = req.params.id; const id = req.params.id;
const populateFields = [{ path: 'vendor' }, { path: 'client' }, { path: 'invoice' }]; const populateFields = [{ path: 'vendor' }, { path: 'client' }, { path: 'invoice' }];

View File

@ -11,6 +11,7 @@ import {
listObjectsByProperties, listObjectsByProperties,
getModelStats, getModelStats,
getModelHistory, getModelHistory,
searchObjects
} from '../../database/database.js'; } from '../../database/database.js';
const logger = log4js.getLogger('TaxRecords'); const logger = log4js.getLogger('TaxRecords');
logger.level = config.server.logLevel; logger.level = config.server.logLevel;
@ -69,6 +70,14 @@ export const listTaxRecordsByPropertiesRouteHandler = async (
res.send(result); res.send(result);
}; };
export const searchTaxRecordsRouteHandler = async (req, res, search) => {
const result = await searchObjects({
model: taxRecordModel,
search,
});
res.send(result);
};
export const getTaxRecordRouteHandler = async (req, res) => { export const getTaxRecordRouteHandler = async (req, res) => {
const id = req.params.id; const id = req.params.id;
const result = await getObject({ const result = await getObject({

View File

@ -12,6 +12,7 @@ import {
listObjectsByProperties, listObjectsByProperties,
getModelStats, getModelStats,
getModelHistory, getModelHistory,
searchObjects
} from '../../database/database.js'; } from '../../database/database.js';
const logger = log4js.getLogger('Filament Stocks'); const logger = log4js.getLogger('Filament Stocks');
logger.level = config.server.logLevel; logger.level = config.server.logLevel;
@ -78,6 +79,14 @@ export const listFilamentStocksByPropertiesRouteHandler = async (
res.send(result); res.send(result);
}; };
export const searchFilamentStocksRouteHandler = async (req, res, search) => {
const result = await searchObjects({
model: filamentStockModel,
search,
});
res.send(result);
};
export const getFilamentStockRouteHandler = async (req, res) => { export const getFilamentStockRouteHandler = async (req, res) => {
const id = req.params.id; const id = req.params.id;
const result = await getObject({ const result = await getObject({

View File

@ -13,6 +13,7 @@ import {
listObjectsByProperties, listObjectsByProperties,
getModelStats, getModelStats,
getModelHistory, getModelHistory,
searchObjects
} from '../../database/database.js'; } from '../../database/database.js';
const logger = log4js.getLogger('Order Items'); const logger = log4js.getLogger('Order Items');
logger.level = config.server.logLevel; logger.level = config.server.logLevel;
@ -123,6 +124,14 @@ export const listOrderItemsByPropertiesRouteHandler = async (
res.send(result); res.send(result);
}; };
export const searchOrderItemsRouteHandler = async (req, res, search) => {
const result = await searchObjects({
model: orderItemModel,
search,
});
res.send(result);
};
export const getOrderItemRouteHandler = async (req, res) => { export const getOrderItemRouteHandler = async (req, res) => {
const id = req.params.id; const id = req.params.id;
const result = await getObject({ const result = await getObject({

View File

@ -12,6 +12,7 @@ import {
listObjectsByProperties, listObjectsByProperties,
getModelStats, getModelStats,
getModelHistory, getModelHistory,
searchObjects
} from '../../database/database.js'; } from '../../database/database.js';
const logger = log4js.getLogger('Part Stocks'); const logger = log4js.getLogger('Part Stocks');
logger.level = config.server.logLevel; logger.level = config.server.logLevel;
@ -74,6 +75,14 @@ export const listPartStocksByPropertiesRouteHandler = async (
res.send(result); res.send(result);
}; };
export const searchPartStocksRouteHandler = async (req, res, search) => {
const result = await searchObjects({
model: partStockModel,
search,
});
res.send(result);
};
export const getPartStockRouteHandler = async (req, res) => { export const getPartStockRouteHandler = async (req, res) => {
const id = req.params.id; const id = req.params.id;
const result = await getObject({ const result = await getObject({

View File

@ -13,6 +13,7 @@ import {
getModelStats, getModelStats,
getModelHistory, getModelHistory,
checkStates, checkStates,
searchObjects
} from '../../database/database.js'; } from '../../database/database.js';
import { productSkuModel } from '../../database/schemas/management/productsku.schema.js'; import { productSkuModel } from '../../database/schemas/management/productsku.schema.js';
const logger = log4js.getLogger('Product Stocks'); const logger = log4js.getLogger('Product Stocks');
@ -80,6 +81,14 @@ export const listProductStocksByPropertiesRouteHandler = async (
res.send(result); res.send(result);
}; };
export const searchProductStocksRouteHandler = async (req, res, search) => {
const result = await searchObjects({
model: productStockModel,
search,
});
res.send(result);
};
export const getProductStockRouteHandler = async (req, res) => { export const getProductStockRouteHandler = async (req, res) => {
const id = req.params.id; const id = req.params.id;
const result = await getObject({ const result = await getObject({

View File

@ -13,6 +13,7 @@ import {
getModelStats, getModelStats,
getModelHistory, getModelHistory,
checkStates, checkStates,
searchObjects
} from '../../database/database.js'; } from '../../database/database.js';
import { orderItemModel } from '../../database/schemas/inventory/orderitem.schema.js'; import { orderItemModel } from '../../database/schemas/inventory/orderitem.schema.js';
import { shipmentModel } from '../../database/schemas/inventory/shipment.schema.js'; import { shipmentModel } from '../../database/schemas/inventory/shipment.schema.js';
@ -78,6 +79,14 @@ export const listPurchaseOrdersByPropertiesRouteHandler = async (
res.send(result); res.send(result);
}; };
export const searchPurchaseOrdersRouteHandler = async (req, res, search) => {
const result = await searchObjects({
model: purchaseOrderModel,
search,
});
res.send(result);
};
export const getPurchaseOrderRouteHandler = async (req, res) => { export const getPurchaseOrderRouteHandler = async (req, res) => {
const id = req.params.id; const id = req.params.id;
const result = await getObject({ const result = await getObject({

View File

@ -13,6 +13,7 @@ import {
getModelStats, getModelStats,
getModelHistory, getModelHistory,
checkStates, checkStates,
searchObjects
} from '../../database/database.js'; } from '../../database/database.js';
const logger = log4js.getLogger('Shipments'); const logger = log4js.getLogger('Shipments');
logger.level = config.server.logLevel; logger.level = config.server.logLevel;
@ -76,6 +77,14 @@ export const listShipmentsByPropertiesRouteHandler = async (
res.send(result); res.send(result);
}; };
export const searchShipmentsRouteHandler = async (req, res, search) => {
const result = await searchObjects({
model: shipmentModel,
search,
});
res.send(result);
};
export const getShipmentRouteHandler = async (req, res) => { export const getShipmentRouteHandler = async (req, res) => {
const id = req.params.id; const id = req.params.id;
const result = await getObject({ const result = await getObject({

View File

@ -3,7 +3,10 @@ import { stockAuditModel } from '../../database/schemas/inventory/stockaudit.sch
import log4js from 'log4js'; import log4js from 'log4js';
import mongoose from 'mongoose'; import mongoose from 'mongoose';
import { getAuditLogs } from '../../utils.js'; import { getAuditLogs } from '../../utils.js';
import { getModelStats, getModelHistory } from '../../database/database.js'; import {
getModelStats, getModelHistory,
searchObjects
} from '../../database/database.js';
const logger = log4js.getLogger('Stock Audits'); const logger = log4js.getLogger('Stock Audits');
logger.level = config.server.logLevel; logger.level = config.server.logLevel;
@ -58,6 +61,14 @@ export const listStockAuditsRouteHandler = async (
} }
}; };
export const searchStockAuditsRouteHandler = async (req, res, search) => {
const result = await searchObjects({
model: stockAuditModel,
search,
});
res.send(result);
};
export const getStockAuditRouteHandler = async (req, res) => { export const getStockAuditRouteHandler = async (req, res) => {
try { try {
const id = new mongoose.Types.ObjectId(req.params.id); const id = new mongoose.Types.ObjectId(req.params.id);

View File

@ -12,6 +12,7 @@ import {
listObjectsByProperties, listObjectsByProperties,
getModelStats, getModelStats,
getModelHistory, getModelHistory,
searchObjects
} from '../../database/database.js'; } from '../../database/database.js';
const logger = log4js.getLogger('Stock Events'); const logger = log4js.getLogger('Stock Events');
logger.level = config.server.logLevel; logger.level = config.server.logLevel;
@ -76,6 +77,14 @@ export const listStockEventsByPropertiesRouteHandler = async (
res.send(result); res.send(result);
}; };
export const searchStockEventsRouteHandler = async (req, res, search) => {
const result = await searchObjects({
model: stockEventModel,
search,
});
res.send(result);
};
export const getStockEventRouteHandler = async (req, res) => { export const getStockEventRouteHandler = async (req, res) => {
const id = req.params.id; const id = req.params.id;
const result = await getObject({ const result = await getObject({

View File

@ -12,6 +12,7 @@ import {
listObjectsByProperties, listObjectsByProperties,
getModelStats, getModelStats,
getModelHistory, getModelHistory,
searchObjects
} from '../../database/database.js'; } from '../../database/database.js';
const logger = log4js.getLogger('Stock Locations'); const logger = log4js.getLogger('Stock Locations');
@ -73,6 +74,14 @@ export const listStockLocationsByPropertiesRouteHandler = async (
res.send(result); res.send(result);
}; };
export const searchStockLocationsRouteHandler = async (req, res, search) => {
const result = await searchObjects({
model: stockLocationModel,
search,
});
res.send(result);
};
export const getStockLocationRouteHandler = async (req, res) => { export const getStockLocationRouteHandler = async (req, res) => {
const id = req.params.id; const id = req.params.id;
const result = await getObject({ const result = await getObject({

Some files were not shown because too many files have changed in this diff Show More