fix(loads/find): Adding est_loading_date field to the find query
This commit is contained in:
@@ -54,7 +54,8 @@ function getAndFilterList( query ){
|
||||
categories,
|
||||
product,
|
||||
shipment_code,
|
||||
shipper_warehouse
|
||||
shipper_warehouse,
|
||||
est_loading_date
|
||||
} = query;
|
||||
|
||||
if( company ){ filter_list.push( { company } ); }
|
||||
@@ -72,6 +73,20 @@ function getAndFilterList( query ){
|
||||
if( product ) { filter_list.push({ product }); }
|
||||
if( shipment_code ) { filter_list.push({ shipment_code }); }
|
||||
if( shipper_warehouse ) { filter_list.push({ shipper_warehouse }); }
|
||||
if( est_loading_date ) {
|
||||
if( (est_loading_date.gte == undefined) || (est_loading_date.gte == null) ){
|
||||
throw "est_loading_date[gte] is required";
|
||||
}
|
||||
if( (est_loading_date.lte == undefined) || (est_loading_date.lte == null) ){
|
||||
throw "est_loading_date[lte] is required";
|
||||
}
|
||||
filter_list.push({
|
||||
"est_loading_date" : {
|
||||
$gte : new Date( est_loading_date["gte"] ),
|
||||
$lte : new Date( est_loading_date["lte"] )
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if( filter_list.length == 0 ){
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user