Editing of the fees before sending / bugfixes
This commit is contained in:
@@ -283,6 +283,22 @@ const deleteBookingChangeIncidentsById = (incidentIds) => {
|
||||
return db.bookingChangeIncident.update({deleted: true},{where: filters});
|
||||
};
|
||||
|
||||
const updateBookingChangeIncidentsById = (incidentFees) => {
|
||||
const incidentIds = Object.keys(incidentFees);
|
||||
|
||||
const asyncUpdateActions = [];
|
||||
|
||||
incidentIds.forEach((incidentId) => {
|
||||
const newFeeCharge = parseFloat(incidentFees[incidentId]);
|
||||
|
||||
if (newFeeCharge || (newFeeCharge === 0)){
|
||||
asyncUpdateActions.push(db.bookingChangeIncident.update({chargeFee: newFeeCharge}, {where: {id: incidentId}}));
|
||||
}
|
||||
});
|
||||
|
||||
return Promise.all(asyncUpdateActions);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
getChargedCanceledReservations,
|
||||
getIncidentsFromChanges,
|
||||
@@ -290,5 +306,6 @@ module.exports = {
|
||||
getShorteningIncidentsForReservationId,
|
||||
getReservationsIncidentsForRemoval,
|
||||
deleteBookingChangeIncidents,
|
||||
deleteBookingChangeIncidentsById
|
||||
deleteBookingChangeIncidentsById,
|
||||
updateBookingChangeIncidentsById
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user