fix(vehicles::events): on driver changed modify loads that are applicable

This commit is contained in:
Josepablo C
2025-07-22 23:47:06 -06:00
parent 94f1bc8fd8
commit e2bd4b8343
2 changed files with 12 additions and 10 deletions

View File

@@ -16,7 +16,7 @@
}
},
"version" : {
"version" : "1.5.8",
"version" : "1.5.9",
"name": "ETA Beta",
"date":"22/07/2025"
},

View File

@@ -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 };