fix: Add shipment_code to loads find filter

This commit is contained in:
Josepablo C
2024-03-21 20:43:50 -06:00
parent e1747aa44e
commit 0c14e22551
3 changed files with 10 additions and 3 deletions

View File

@@ -11,7 +11,7 @@ const generic = new GenericHandler( Model, null, populate_list );
function getAndFilterList( query ){
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( 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( categories ) { filter_list.push({ categories }); }
if( product ) { filter_list.push({ product }); }
if( shipment_code ) { filter_list.push({ shipment_code }); }
if( filter_list.length == 0 ){
return null;

View File

@@ -58,7 +58,6 @@ async function findElements( companyId , query ){
}else{
filter = { company : companyId };
}
console.log( filter );
const { total , limit, skip, data } = await generic.getList( page , elements, filter );
return {
total,