mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-04 15:07:13 +01:00
also get booked days from calendar
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import * as mongoose from 'mongoose'
|
||||
import BookingModel, { Booking, BookingDocument } from './booking'
|
||||
import BillModel, { Bill } from './bill'
|
||||
import { getBookedDays as calendarGetBookedDays } from '../lib/googlecalendar'
|
||||
import { BOOKING_STATUS } from './enums'
|
||||
import { uniqueFilter } from '../helpers/array'
|
||||
|
||||
let connectedPromise: Promise<mongoose.Mongoose>
|
||||
|
||||
@@ -21,7 +23,12 @@ export async function getBookedDays(
|
||||
uuidsToIngore?: string[]
|
||||
): Promise<string[]> {
|
||||
await connect()
|
||||
return BookingModel.findBookedDays(uuidsToIngore)
|
||||
const bookedInDatabase = await BookingModel.findBookedDays(uuidsToIngore);
|
||||
const bookedInCalendar = await calendarGetBookedDays();
|
||||
|
||||
return [ ...bookedInDatabase, ...bookedInCalendar]
|
||||
.filter(uniqueFilter)
|
||||
.sort();
|
||||
}
|
||||
|
||||
export async function getBookingByUUID(uuid: string): Promise<BookingDocument> {
|
||||
|
||||
Reference in New Issue
Block a user