fetch reservations, find and update changed reservations
This commit is contained in:
24
cronServices/checkBookingChanges.js
Normal file
24
cronServices/checkBookingChanges.js
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
require('dotenv').config();
|
||||
|
||||
const { fetchAllBookings, bulkWriteReservationsWithChangesTracking } = require('../services/officeRnD/bookings');
|
||||
|
||||
const checkBookingChanges = () => {
|
||||
fetchAllBookings()
|
||||
.then((reservations) => {
|
||||
bulkWriteReservationsWithChangesTracking(reservations)
|
||||
.then((changes) => {
|
||||
console.log('== CHANGES == ');
|
||||
console.log(changes);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('Error bulk write booking reservations :', error);
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('Error fetching bookings from ORD ', error);
|
||||
});
|
||||
};
|
||||
|
||||
checkBookingChanges();
|
||||
Reference in New Issue
Block a user