Member Practice Summary Report and bugfixes
This commit is contained in:
@@ -48,6 +48,41 @@ 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 attributes = [
|
||||
'id',
|
||||
'reservationId',
|
||||
'memberId',
|
||||
'officeId',
|
||||
'resourceId',
|
||||
'start',
|
||||
'end',
|
||||
'timezone',
|
||||
'canceled',
|
||||
'hourlyRate'
|
||||
];
|
||||
|
||||
const filters = {};
|
||||
|
||||
if (startDate && endDate) {
|
||||
filters.start = {
|
||||
[Op.gte]: startDate.toISOString()
|
||||
};
|
||||
filters.end = {
|
||||
[Op.lte]: endDate.toISOString(),
|
||||
};
|
||||
}
|
||||
|
||||
return db.bookingReservation.findAll({
|
||||
attributes,
|
||||
where: filters,
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
getActiveBookingsForMembersInDateRange,
|
||||
getAllBookingsForYear,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user