Discounts support / make rates configurable

This commit is contained in:
Senad Uka
2019-08-16 05:16:27 +02:00
parent d2ac43bac4
commit d788f66e1a
12 changed files with 370 additions and 24 deletions

View File

@@ -48,9 +48,9 @@ const getActiveBookingsForMembersInDateRange = (dateRange, memberIds) => {
});
};
const getAllBookingsForYear = (year) => {
const startDate = moment.tz(year, 'YYYY', UI_TIMEZONE).startOf('year');
const endDate = moment.tz(year, 'YYYY', UI_TIMEZONE).endOf('year');
const getAllBookingsForMembersInDateRange = (dateRange, memberIds) => {
const startDate = moment.tz(dateRange.startDate, DEFAULT_DATE_FORMAT, UI_TIMEZONE).startOf('day');
const endDate = moment.tz(dateRange.endDate, DEFAULT_DATE_FORMAT, UI_TIMEZONE).endOf('day');
const attributes = [
'id',
@@ -76,6 +76,12 @@ const getAllBookingsForYear = (year) => {
};
}
if (memberIds && Array.isArray(memberIds) && memberIds.length > 0){
filters.memberId = {
[Op.in]: memberIds
};
}
return db.bookingReservation.findAll({
attributes,
where: filters,
@@ -84,5 +90,5 @@ const getAllBookingsForYear = (year) => {
module.exports = {
getActiveBookingsForMembersInDateRange,
getAllBookingsForYear,
getAllBookingsForMembersInDateRange,
};