feat: Adding alert_list filter to loads/branches

This commit is contained in:
Josepablo C
2025-06-04 13:24:40 -06:00
parent 12e192b4d2
commit 9775df7577
2 changed files with 15 additions and 2 deletions

View File

@@ -10,7 +10,17 @@ const generic = new GenericHandler( Model, null, populate_list );
function getAndFilterList( query ){ function getAndFilterList( query ){
const filter_list = []; const filter_list = [];
const { categories, branch_name, phone, city, state, truck_type, type, zipcode } = query; const {
categories,
branch_name,
phone,
city,
state,
truck_type,
type,
zipcode,
alert_list,
} = query;
if( categories ) { filter_list.push({ categories }); } if( categories ) { filter_list.push({ categories }); }
if( branch_name ) { filter_list.push({ branch_name }); } if( branch_name ) { filter_list.push({ branch_name }); }
@@ -20,6 +30,7 @@ function getAndFilterList( query ){
if( truck_type ) { filter_list.push({ truck_type }); } if( truck_type ) { filter_list.push({ truck_type }); }
if( type ) { filter_list.push({ type }); } if( type ) { filter_list.push({ type }); }
if( zipcode ) { filter_list.push({ zipcode }); } if( zipcode ) { filter_list.push({ zipcode }); }
if( alert_list ) { filter_list.push({ alert_list }); }
if( filter_list.length == 0 ){ if( filter_list.length == 0 ){
return null; return null;

View File

@@ -55,7 +55,8 @@ function getAndFilterList( query ){
product, product,
shipment_code, shipment_code,
shipper_warehouse, shipper_warehouse,
est_loading_date est_loading_date,
alert_list,
} = query; } = query;
if( company ){ filter_list.push( { company } ); } if( company ){ filter_list.push( { company } ); }
@@ -73,6 +74,7 @@ function getAndFilterList( query ){
if( product ) { filter_list.push({ product }); } if( product ) { filter_list.push({ product }); }
if( shipment_code ) { filter_list.push({ shipment_code }); } if( shipment_code ) { filter_list.push({ shipment_code }); }
if( shipper_warehouse ) { filter_list.push({ shipper_warehouse }); } if( shipper_warehouse ) { filter_list.push({ shipper_warehouse }); }
if( alert_list ) { filter_list.push({ alert_list }); }
if( est_loading_date ) { if( est_loading_date ) {
if( (est_loading_date.gte == undefined) || (est_loading_date.gte == null) ){ if( (est_loading_date.gte == undefined) || (est_loading_date.gte == null) ){
throw "est_loading_date[gte] is required"; throw "est_loading_date[gte] is required";