fix non-returning promise warning

This commit is contained in:
Bilal Catic
2019-08-21 06:45:43 +02:00
parent 5a0426cc12
commit 27cbe1f51c
4 changed files with 74 additions and 28 deletions

View File

@@ -2,7 +2,7 @@
const { fetchAllBookings, bulkWriteReservationsWithChangesTracking } = require('../officeRnD/bookings');
const { chargeBookingChanges } = require('./bookingChangeCharges');
const { getIncidentsFromChanges, bulkWriteBookingChangeIncidents } = require('./bookingChangeCharges');
const { bulkWriteChanges } = require('./bookingChangeLog');
const checkBookingChanges = () => {
@@ -13,9 +13,11 @@ const checkBookingChanges = () => {
.then((changes) => {
bulkWriteChanges(changes)
.then(() => {
chargeBookingChanges(changes)
.then(() => {
resolve(true);
getIncidentsFromChanges(changes)
.then((incidents) => {
bulkWriteBookingChangeIncidents(incidents)
.then(() => resolve(true))
.catch((error) => reject(error));
})
.catch((error) => {
console.log('Error creating charges ', error);