mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-03 06:27:11 +01:00
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:
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"files.readonlyInclude": {
|
||||||
|
"**/*": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -101,16 +101,15 @@ const BookingSchema = new mongoose.Schema(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
BookingSchema.pre('validate', function (next: () => void): void {
|
BookingSchema.pre('validate', function (): void {
|
||||||
const booking = this
|
const booking = this
|
||||||
booking.days = getDays({
|
booking.days = getDays({
|
||||||
startDate: new Date(booking.startDate),
|
startDate: new Date(booking.startDate),
|
||||||
endDate: new Date(booking.endDate),
|
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
|
const booking = this
|
||||||
|
|
||||||
if (!booking.calendarEventId) {
|
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
|
// event has been canceled or rejected, delete calendar event again to free up the slot
|
||||||
await deleteCalendarEvent(booking.toJSON())
|
await deleteCalendarEvent(booking.toJSON())
|
||||||
}
|
}
|
||||||
|
|
||||||
next()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
BookingSchema.static(
|
BookingSchema.static(
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
"date-fns": "^4.1.0",
|
"date-fns": "^4.1.0",
|
||||||
"googleapis": "^148.0.0",
|
"googleapis": "^148.0.0",
|
||||||
"ics": "^3.8.1",
|
"ics": "^3.8.1",
|
||||||
"mongoose": "^8.15.1",
|
"mongoose": "^9.1.5",
|
||||||
"next": "^15.3.9",
|
"next": "^15.3.9",
|
||||||
"next-auth": "^4.24.13",
|
"next-auth": "^4.24.13",
|
||||||
"next-axiom": "^1.10.0",
|
"next-axiom": "^1.10.0",
|
||||||
|
|||||||
7736
pnpm-lock.yaml
generated
Normal file
7736
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user