feat(loads): Adding shipper_warehouse as filter to the calendars endpoint

This commit is contained in:
Josepablo C
2025-03-02 20:44:05 -06:00
parent 67d8e9a3a8
commit 7e273bc0d8

View File

@@ -111,10 +111,12 @@ async function findCalendarLoads( userId, companyId, query ){
"createdAt", "createdAt",
"shipment_code", "shipment_code",
"est_loading_date", "est_loading_date",
"est_unloading_date" "est_unloading_date",
"shipper_warehouse"
]; ];
const { date, load_status , $sort } = query; const { date, load_status , $sort } = query;
const { global } = query; const { global } = query;
const { shipper_warehouse } = query;
if( ! date ){ if( ! date ){
throw "Date field is required"; throw "Date field is required";
@@ -152,6 +154,10 @@ async function findCalendarLoads( userId, companyId, query ){
andFilterList.push( { load_status } ) andFilterList.push( { load_status } )
} }
if( shipper_warehouse ){
andFilterList.push( { shipper_warehouse } )
}
const filter = { const filter = {
$and : andFilterList, $and : andFilterList,
}; };