update mongoose to 5.8.3 (lots of types changes)

This commit is contained in:
Thomas Ruoff
2024-09-10 22:44:25 +02:00
parent 3ecbd16a2c
commit 32818b7492
22 changed files with 136 additions and 251 deletions

View File

@@ -1,6 +1,6 @@
import { google } from 'googleapis'
import { getBaseURL } from '../helpers/url'
import { Booking } from '../db/booking'
import { IBooking } from '../db/booking'
import { getDays, getNextDay, dateFormatBackend } from '../helpers/date'
import { log } from '../helpers/log'
@@ -47,7 +47,7 @@ export async function getBookedDays() {
)
}
function getSummary(booking: Partial<Booking>): string {
function getSummary(booking: Partial<IBooking>): string {
let summary = ''
if (booking.org) {
@@ -59,13 +59,15 @@ function getSummary(booking: Partial<Booking>): string {
return summary
}
function getDescription(booking: Booking): string {
function getDescription(booking: IBooking): string {
const bookingUrl = `${getBaseURL()}/admin/bookings/${booking.uuid}`
return `Managelink ${bookingUrl}`
}
export async function createCalendarEvent(booking: Booking): Promise<Booking> {
export async function createCalendarEvent(
booking: IBooking
): Promise<IBooking> {
const exclusiveEndDate = dateFormatBackend(
getNextDay(new Date(booking.endDate))
)
@@ -85,7 +87,7 @@ export async function createCalendarEvent(booking: Booking): Promise<Booking> {
return booking
}
export async function deleteCalendarEvent(booking: Booking) {
export async function deleteCalendarEvent(booking: IBooking) {
await calendar.events.delete({
calendarId,
eventId: booking.calendarEventId,
@@ -95,12 +97,3 @@ export async function deleteCalendarEvent(booking: Booking) {
booking.calendarEventId = null
}
//export async function patchCalendarEvent(booking: { calendarEventId: string } & Partial<Booking> ) : Promise<Booking> {
// const response = await calendar.events.patch({
// calendarId,
// eventId: booking.calendarEventId,
// });
//
// return booking;
//}