mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-03 06:27:11 +01:00
another try to fix types for models
This commit is contained in:
committed by
Thomas Ruoff
parent
82270e944c
commit
038e2b2420
@@ -1,5 +1,5 @@
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { Booking } from '../../../db/booking'
|
||||
import { BookingDocument } from '../../../db/booking'
|
||||
import { BOOKING_STATUS } from '../../../db/bookingStatus'
|
||||
import { getBookingByUUID } from '../../../db/index'
|
||||
|
||||
@@ -14,7 +14,7 @@ export default async function userHandler(
|
||||
|
||||
const uuid = Array.isArray(uuids) ? uuids[0] : uuids
|
||||
|
||||
let booking: Booking
|
||||
let booking: BookingDocument
|
||||
|
||||
switch (method) {
|
||||
case 'PATCH':
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Error } from 'mongoose'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { Booking } from '../../../db/booking'
|
||||
import { BookingDocument } from '../../../db/booking'
|
||||
import { createBooking } from '../../../db/index'
|
||||
import { sendReceivedBookingMail } from '../../../helpers/mail'
|
||||
|
||||
@@ -10,7 +10,7 @@ export default async function userHandler(
|
||||
) {
|
||||
const { method } = req
|
||||
|
||||
let booking: Booking
|
||||
let booking: BookingDocument
|
||||
|
||||
switch (method) {
|
||||
case 'POST':
|
||||
|
||||
@@ -2,7 +2,7 @@ import { GetServerSideProps } from 'next'
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import Footer from '../../components/footer'
|
||||
import Header from '../../components/header'
|
||||
import { Booking } from '../../db/booking'
|
||||
import { BookingDocument } from '../../db/booking'
|
||||
import { BOOKING_STATUS } from '../../db/bookingStatus'
|
||||
import { getBookingByUUID } from '../../db/index'
|
||||
import { dateFormatFrontend } from '../../helpers/date'
|
||||
@@ -28,7 +28,7 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
|
||||
}
|
||||
}
|
||||
|
||||
function getBookingStatus(booking: Booking) {
|
||||
function getBookingStatus(booking: BookingDocument) {
|
||||
switch (booking.status) {
|
||||
case BOOKING_STATUS.REQUESTED:
|
||||
return 'In Bearbeitung'
|
||||
@@ -43,7 +43,7 @@ function getBookingStatus(booking: Booking) {
|
||||
}
|
||||
}
|
||||
|
||||
async function cancelBooking(booking: Booking) {
|
||||
async function cancelBooking(booking: BookingDocument) {
|
||||
const response = await fetch(`/api/booking/${booking.uuid}`, {
|
||||
method: 'PATCH',
|
||||
mode: 'cors',
|
||||
@@ -61,7 +61,7 @@ async function cancelBooking(booking: Booking) {
|
||||
export default function ShowBooking({
|
||||
booking: bookingProp,
|
||||
}: {
|
||||
booking: Booking
|
||||
booking: BookingDocument
|
||||
}) {
|
||||
const [booking, setBooking] = useState(bookingProp)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user