fix: Add shipment_code to loads find filter
This commit is contained in:
@@ -5,7 +5,8 @@
|
|||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node src/",
|
"start": "node src/",
|
||||||
"dev": "nodemon src/"
|
"dev": "nodemon src/",
|
||||||
|
"test":"mocha test/lib/handlers/proposals"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -42,5 +43,10 @@
|
|||||||
"nodemon": "^3.0.1",
|
"nodemon": "^3.0.1",
|
||||||
"objection": "^3.1.2",
|
"objection": "^3.1.2",
|
||||||
"uuid": "^9.0.1"
|
"uuid": "^9.0.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"chai": "^5.1.0",
|
||||||
|
"mocha": "^10.3.0",
|
||||||
|
"sinon": "^17.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ const generic = new GenericHandler( Model, null, populate_list );
|
|||||||
|
|
||||||
function getAndFilterList( query ){
|
function getAndFilterList( query ){
|
||||||
const filter_list = [];
|
const filter_list = [];
|
||||||
const { status, posted_by_name, load_status, published_date, loaded_date, transit_date, categories, product } = query;
|
const { status, posted_by_name, load_status, published_date, loaded_date, transit_date, categories, product, shipment_code } = query;
|
||||||
|
|
||||||
if( status ){ filter_list.push( { status } ); }
|
if( status ){ filter_list.push( { status } ); }
|
||||||
if( posted_by_name ) { filter_list.push({ posted_by_name }); }
|
if( posted_by_name ) { filter_list.push({ posted_by_name }); }
|
||||||
@@ -21,6 +21,8 @@ function getAndFilterList( query ){
|
|||||||
if( transit_date ) { filter_list.push({ transit_date }); }
|
if( transit_date ) { filter_list.push({ transit_date }); }
|
||||||
if( categories ) { filter_list.push({ categories }); }
|
if( categories ) { filter_list.push({ categories }); }
|
||||||
if( product ) { filter_list.push({ product }); }
|
if( product ) { filter_list.push({ product }); }
|
||||||
|
if( shipment_code ) { filter_list.push({ shipment_code }); }
|
||||||
|
|
||||||
|
|
||||||
if( filter_list.length == 0 ){
|
if( filter_list.length == 0 ){
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ async function findElements( companyId , query ){
|
|||||||
}else{
|
}else{
|
||||||
filter = { company : companyId };
|
filter = { company : companyId };
|
||||||
}
|
}
|
||||||
console.log( filter );
|
|
||||||
const { total , limit, skip, data } = await generic.getList( page , elements, filter );
|
const { total , limit, skip, data } = await generic.getList( page , elements, filter );
|
||||||
return {
|
return {
|
||||||
total,
|
total,
|
||||||
|
|||||||
Reference in New Issue
Block a user