mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-04 23:17:12 +01:00
update mongoose to 5.8.3 (lots of types changes)
This commit is contained in:
@@ -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`)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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':
|
||||
|
||||
Reference in New Issue
Block a user