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,5 +1,5 @@
import { NextApiRequest, NextApiResponse } from 'next'
import { Bill } from '../../../../db/bill'
import { IBill } from '../../../../db/bill'
import { createBill, patchBill } from '../../../../db/index'
import { log } from '../../../../helpers/log'
@@ -13,7 +13,7 @@ export default async function billHandler(
} = req
const bookingUUID = Array.isArray(uuids) ? uuids[0] : uuids
let bill: Bill
let bill: IBill
switch (method) {
case 'POST':
@@ -40,4 +40,4 @@ export default async function billHandler(
res.setHeader('Allow', ['POST', 'PATCH'])
res.status(405).end(`Method ${method} Not Allowed`)
}
}
}

View File

@@ -1,5 +1,5 @@
import { NextApiRequest, NextApiResponse } from 'next'
import { Booking } from '../../../../db/booking'
import { IBooking } from '../../../../db/booking'
import { BOOKING_STATUS } from '../../../../db/enums'
import { patchBooking } from '../../../../db/index'
import {
@@ -10,8 +10,8 @@ import {
import { log } from '../../../../helpers/log'
function changedStatus(
previous: Booking,
current: Partial<Booking>,
previous: IBooking,
current: Partial<IBooking>,
status: BOOKING_STATUS
): boolean {
return (
@@ -19,15 +19,15 @@ function changedStatus(
current.status === status
)
}
function wasRejected(previous: Booking, current: Partial<Booking>): boolean {
function wasRejected(previous: IBooking, current: Partial<IBooking>): boolean {
return changedStatus(previous, current, BOOKING_STATUS.REJECTED)
}
function wasConfirmed(previous: Booking, current: Partial<Booking>): boolean {
function wasConfirmed(previous: IBooking, current: Partial<IBooking>): boolean {
return changedStatus(previous, current, BOOKING_STATUS.CONFIRMED)
}
function wasCanceled(previous: Booking, current: Partial<Booking>): boolean {
function wasCanceled(previous: IBooking, current: Partial<IBooking>): boolean {
return (
[BOOKING_STATUS.REQUESTED, BOOKING_STATUS.CONFIRMED].includes(
previous.status

View File

@@ -1,6 +1,6 @@
import { Error } from 'mongoose'
import { NextApiRequest, NextApiResponse } from 'next'
import { Booking } from '../../../db/booking'
import { IBooking } from '../../../db/booking'
import { createBooking } from '../../../db/index'
import { log } from '../../../helpers/log'
import {
@@ -14,7 +14,7 @@ export default async function userHandler(
): Promise<void> {
const { method } = req
let booking: Booking
let booking: IBooking
switch (method) {
case 'POST':