use BOOKING_STATE in database calls

This commit is contained in:
Thomas Ruoff
2020-08-25 23:55:42 +02:00
parent 1dcfef205c
commit 18722261eb

View File

@@ -2,6 +2,7 @@ import * as mongoose from 'mongoose'
import Booker from './booker' import Booker from './booker'
import Booking from './booking' import Booking from './booking'
import { BOOKING_STATUS } from './bookingStatus'
let connectedPromise let connectedPromise
@@ -23,7 +24,7 @@ export async function getBookedDays() {
const bookings = await Booking.find( const bookings = await Booking.find(
{ {
status: { $ne: 'rejected' }, status: { $in: [BOOKING_STATUS.REQUESTED, BOOKING_STATUS.CONFIRMED] },
$or: [ $or: [
{ endDate: { $gt: new Date() } }, { endDate: { $gt: new Date() } },
{ startDate: { $gt: new Date() } }, { startDate: { $gt: new Date() } },