firt attempt for an ics calendar

This commit is contained in:
Thomas Ruoff
2020-09-16 00:31:42 +02:00
committed by Thomas Ruoff
parent 2b0cbe565f
commit 56c8263e90
5 changed files with 121 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ import * as mongoose from 'mongoose'
import Booker from './booker'
import Booking from './booking'
import { dateFormatFrontend } from '../helpers/date'
import { BOOKING_STATUS } from './bookingStatus'
let connectedPromise: Promise<typeof mongoose>
@@ -29,6 +30,15 @@ export async function getBookingByUUID(uuid: string) {
return booking?.populate('booker').execPopulate()
}
export async function getBookings() {
await connect()
const bookings = await Booking.find({
status: { $in: [BOOKING_STATUS.REQUESTED, BOOKING_STATUS.CONFIRMED] },
})
// populate?
return bookings
}
export async function createBooking({
startDate,
endDate,