summaryrefslogtreecommitdiff
path: root/src/services
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2021-04-17 19:57:19 +0300
committereug-vs <eug-vs@keemail.me>2021-04-17 19:57:19 +0300
commit1da159d1102bf0ded9ce50d447c821258c7be800 (patch)
treefe6c86300f933abf0756b846d76bbe8f3abd63d6 /src/services
parentf34d29c80850bdf582d1568dc98ae67d1895f082 (diff)
downloadcommercel-api-1da159d1102bf0ded9ce50d447c821258c7be800.tar.gz
feat: add ignoreCaseRegex hook
Diffstat (limited to 'src/services')
-rw-r--r--src/services/index.ts3
-rw-r--r--src/services/products.service.ts2
2 files changed, 3 insertions, 2 deletions
diff --git a/src/services/index.ts b/src/services/index.ts
index 42b1fbd..b94380d 100644
--- a/src/services/index.ts
+++ b/src/services/index.ts
@@ -6,6 +6,7 @@ import Tranfers from './transfers.service';
import Spreadsheets from './spreadsheets.service';
import Uploads from './uploads.service';
import sortByDate from '../hooks/sortByDate';
+import ignoreCaseRegex from '../hooks/ignoreCaseRegex';
export default (app: Application): void => {
app.configure(Products);
@@ -19,7 +20,7 @@ export default (app: Application): void => {
app.hooks({
before: {
- find: sortByDate
+ find: [sortByDate, ignoreCaseRegex]
},
})
};
diff --git a/src/services/products.service.ts b/src/services/products.service.ts
index f3ae2b6..9934a66 100644
--- a/src/services/products.service.ts
+++ b/src/services/products.service.ts
@@ -2,7 +2,7 @@ import { Application } from '@feathersjs/express';
import service from 'feathers-mongoose';
import Model from '../models/product/product.model';
-const Products = service({ Model });
+const Products = service({ Model, whitelist: ['$options', '$regex'] });
export default (app: Application): void => {
app.use('/products', Products);