further work on billing

This commit is contained in:
Thomas Ruoff
2020-10-07 00:32:22 +02:00
committed by Thomas Ruoff
parent f8434233d9
commit c396cdcbf9
6 changed files with 75 additions and 52 deletions

View File

@@ -1,6 +1,6 @@
import { NextApiRequest, NextApiResponse } from 'next'
import { BillDocument } from '../../../../db/bill'
import { createBill } from '../../../../db/index'
import { createBill, patchBill } from '../../../../db/index'
export default async function userHandler(
req: NextApiRequest,
@@ -26,6 +26,16 @@ export default async function userHandler(
return
}
break
case 'PATCH':
try {
bill = await patchBill(bookingUUID, req.body)
res.status(200).json(bill)
} catch (e) {
console.error(e)
res.status(500).end(`Internal Server Error...Guru is meditating...`)
return
}
break
default:
res.setHeader('Allow', ['POST'])
res.status(405).end(`Method ${method} Not Allowed`)