feat(loads::events): Adding load state events

This commit is contained in:
Josepablo C
2025-07-22 22:51:26 -06:00
parent b5e9ced8ad
commit f2d8eb43bd
9 changed files with 193 additions and 9 deletions

View File

@@ -56,4 +56,62 @@ async function onProposalVehicleChanged( notification_type, content ){
}
}
module.exports = { NOTIFICATION_TYPE, onProposalAccepted, onProposalDriverChanged, onProposalVehicleChanged };
async function onLoadLoading( notification_type, content ){
const { load, carrier, product, vehicle, driver } = content;
switch ( notification_type ){
case NOTIFICATION_TYPE.CLIENT:
case NOTIFICATION_TYPE.BOTH:
return await ClientEvents.onLoadLoading( load, carrier, product, vehicle, driver );
default:
return;
}
}
async function onLoadInTransit( notification_type, content ){
const { load, carrier, product, vehicle, driver } = content;
switch ( notification_type ){
case NOTIFICATION_TYPE.CLIENT:
case NOTIFICATION_TYPE.BOTH:
return await ClientEvents.onLoadInTransit( load, carrier, product, vehicle, driver );
default:
return;
}
}
async function onLoadDownload( notification_type, content ){
const { load, carrier, product, vehicle, driver } = content;
switch ( notification_type ){
case NOTIFICATION_TYPE.CLIENT:
case NOTIFICATION_TYPE.BOTH:
return await ClientEvents.onLoadDownload( load, carrier, onLoadOnDownload, vehicle, driver );
default:
return;
}
}
async function onLoadDelivered( notification_type, content ){
const { load, carrier, product, vehicle, driver } = content;
switch ( notification_type ){
case NOTIFICATION_TYPE.CLIENT:
case NOTIFICATION_TYPE.BOTH:
return await ClientEvents.onLoadDelivered( load, carrier, product, vehicle, driver );
default:
return;
}
}
module.exports = {
NOTIFICATION_TYPE,
onProposalAccepted,
onProposalDriverChanged,
onProposalVehicleChanged,
onLoadLoading,
onLoadInTransit,
onLoadDownload,
onLoadDelivered,
};