Fix bug with calendar

This commit is contained in:
Senad Uka
2019-08-26 05:03:16 +02:00
parent 2ac4074d94
commit 1447d800bf
9 changed files with 245 additions and 59 deletions

View File

@@ -2,7 +2,7 @@
const db = require('../../models/index');
const bulkWriteChanges = ((changes) => {
const bulkWriteChanges = (changes) => {
const changeLogsForDB = [];
changes.forEach((change) => {
@@ -48,8 +48,19 @@ const bulkWriteChanges = ((changes) => {
return db.bookingReservationChangeLog.bulkCreate(changeLogsForDB);
// console.log(changeLogsForDB);
// return new Promise((resolve) => resolve());
});
};
const getBookingChangeLogsForReservationId = (reservationId) => {
const filter = {
reservationId,
};
const order = [['createdAt', 'ASC']];
return db.bookingReservationChangeLog.findAll({where: filter, order});
};
module.exports = {
bulkWriteChanges,
getBookingChangeLogsForReservationId,
};