add /booking/uuid

This commit is contained in:
Thomas Ruoff
2020-08-22 00:09:11 +02:00
parent 7dea0153c4
commit e9f4753fdc
4 changed files with 42 additions and 13 deletions

View File

@@ -0,0 +1,20 @@
import { getBookingByUUID, createBooking } from '../../../db/index'
export default async function userHandler(req, res) {
const {
method,
query: { uuid },
} = req
let booking
switch (method) {
case 'GET':
booking = await getBookingByUUID(uuid)
res.status(200).json(booking)
break
default:
res.setHeader('Allow', ['POST'])
res.status(405).end(`Method ${method} Not Allowed`)
}
}

View File

@@ -1,7 +1,7 @@
import { createBooking } from '../../db/index'
import { createBooking } from '../../../db/index'
import { Error } from 'mongoose'
import { sendReceivedBookingMail } from '../../helpers/mail'
import { sendReceivedBookingMail } from '../../../helpers/mail'
export default async function userHandler(req, res) {
const { method } = req