fix(vehicles::events): on driver changed modify loads that are applicable
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
}
|
||||
},
|
||||
"version" : {
|
||||
"version" : "1.5.8",
|
||||
"version" : "1.5.9",
|
||||
"name": "ETA Beta",
|
||||
"date":"22/07/2025"
|
||||
},
|
||||
|
||||
@@ -50,6 +50,7 @@ async function onVehicleDriverChanged( userId, vehicleId ){
|
||||
for( const proposal of proposal_list ){
|
||||
if( proposal.is_accepted === true ){
|
||||
const load = await loadsModel.findById( proposal.load );
|
||||
if( load ){
|
||||
const origin_warehouse = await branchesModel.findById( load.origin_warehouse );
|
||||
const destination_warehouse = await branchesModel.findById( load.destination_warehouse );
|
||||
const carrier = await companiesModel.findById( load.carrier ) || {};
|
||||
@@ -64,5 +65,6 @@ async function onVehicleDriverChanged( userId, vehicleId ){
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { onVehicleDriverChanged };
|
||||
|
||||
Reference in New Issue
Block a user