fix non-returning promise warning
This commit is contained in:
@@ -205,27 +205,34 @@ const bulkWriteReservationsWithChangesTracking = (reservations) => {
|
||||
individualHooks: true,
|
||||
})
|
||||
.then(([updateCount, updatedInstances]) => {
|
||||
if (updateCount === 0){
|
||||
const oldReservation = {
|
||||
start: null,
|
||||
end: null,
|
||||
resourceId: null,
|
||||
};
|
||||
try {
|
||||
if (updateCount === 0) {
|
||||
const oldReservation = {
|
||||
start: null,
|
||||
end: null,
|
||||
resourceId: null,
|
||||
};
|
||||
|
||||
changes.push({
|
||||
oldReservation,
|
||||
newReservation: reservation,
|
||||
});
|
||||
resolve(db.bookingReservation.upsert(reservation));
|
||||
}else{
|
||||
resolve();
|
||||
changes.push({
|
||||
oldReservation,
|
||||
newReservation: reservation,
|
||||
});
|
||||
db.bookingReservation.upsert(reservation)
|
||||
.then(() => resolve())
|
||||
.catch((error) => reject(error));
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
}catch (e) {
|
||||
console.log('CATCH E : ', e);
|
||||
reject(e);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('Error updating');
|
||||
console.log(error);
|
||||
reject(error);
|
||||
})
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user