implement booking reservation change log

This commit is contained in:
Bilal Catic
2019-07-15 01:24:18 +02:00
parent 8a0e198690
commit e150ebc7e8
6 changed files with 150 additions and 28 deletions

View File

@@ -24,7 +24,6 @@ const chargeBookingChanges = (changes) => {
return new Promise((resolve, reject) => {
if (Array.isArray(changes)){
const incidents = [];
const errors = [];
changes.forEach((change) => {
const { oldReservation, newReservation } = change;
if (oldReservation && newReservation){
@@ -97,14 +96,10 @@ const chargeBookingChanges = (changes) => {
}
}
}else{
errors.push(change);
// New reservation or canceled, not an incident
}
}
});
if (errors.length > 0){
console.log('There were some errors with incomplete bookings : ');
console.log(errors);
}
resolve(bulkWriteBookingChangeIncidents(incidents));
}else{
reject('Input argument is not an array !');