feat: upgrade to Mongoose 9 and adjust middleware

Update `mongoose` to v9.1.5 and convert middleware hooks.

Co-authored-by: Thomas Ruoff <111471+tomru@users.noreply.github.com>
This commit is contained in:
v0
2026-02-06 07:17:37 +00:00
committed by Thomas Ruoff
parent 29a5d638e9
commit 90d9ab2d67
4 changed files with 7744 additions and 6 deletions

5
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,5 @@
{
"files.readonlyInclude": {
"**/*": true
}
}

View File

@@ -101,16 +101,15 @@ const BookingSchema = new mongoose.Schema(
}
)
BookingSchema.pre('validate', function (next: () => void): void {
BookingSchema.pre('validate', function (): void {
const booking = this
booking.days = getDays({
startDate: new Date(booking.startDate),
endDate: new Date(booking.endDate),
})
next()
})
BookingSchema.pre('save', async function (next: () => void): Promise<void> {
BookingSchema.pre('save', async function (): Promise<void> {
const booking = this
if (!booking.calendarEventId) {
@@ -122,8 +121,6 @@ BookingSchema.pre('save', async function (next: () => void): Promise<void> {
// event has been canceled or rejected, delete calendar event again to free up the slot
await deleteCalendarEvent(booking.toJSON())
}
next()
})
BookingSchema.static(

View File

@@ -23,7 +23,7 @@
"date-fns": "^4.1.0",
"googleapis": "^148.0.0",
"ics": "^3.8.1",
"mongoose": "^8.15.1",
"mongoose": "^9.1.5",
"next": "^15.3.9",
"next-auth": "^4.24.13",
"next-axiom": "^1.10.0",

7736
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff