mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-03 06:27:11 +01:00
add /booking/uuid
This commit is contained in:
20
pages/api/booking/[uuid].js
Normal file
20
pages/api/booking/[uuid].js
Normal 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`)
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user