generate practice summary report; send report to frontend

This commit is contained in:
Bilal Catic
2019-08-08 01:55:00 +02:00
parent 12523fde5b
commit 3f16ec5949
12 changed files with 13279 additions and 10 deletions

View File

@@ -2,6 +2,7 @@
const moment = require('moment-timezone');
const db = require('../../models/index');
const Op = require('sequelize').Op;
const { UI_TIMEZONE, BOOKING_CHANGE_PERCENTAGE_CHARGE, ALLOWED_BOOKING_CANCELLATION_TIME, incidentType } = require('../../constants/constants');
@@ -128,6 +129,20 @@ const chargeBookingChanges = (changes) => {
});
};
const getChargedCanceledReservations = (reservationIds) => {
const filters = {
reservationId: {
[Op.in]: reservationIds,
},
incidentType: incidentType.BOOKING_CANCELED_LATE,
};
const attributes = ['memberId', 'oldBookingStart', 'oldBookingEnd'];
return db.bookingChangeIncident.findAll({attributes, where: filters});
};
module.exports = {
chargeBookingChanges,
getChargedCanceledReservations,
};