remove all bill related stuff

This commit is contained in:
Thomas Ruoff
2025-03-26 23:14:35 +01:00
parent 56721a12c7
commit d5ac2f09dc
9 changed files with 9 additions and 577 deletions

View File

@@ -1,43 +0,0 @@
import { NextApiRequest, NextApiResponse } from 'next'
import { IBill } from '../../../../db/bill'
import { createBill, patchBill } from '../../../../db/index'
import { log } from '../../../../helpers/log'
export default async function billHandler(
req: NextApiRequest,
res: NextApiResponse
): Promise<void> {
const {
method,
query: { uuid: uuids },
} = req
const bookingUUID = Array.isArray(uuids) ? uuids[0] : uuids
let bill: IBill
switch (method) {
case 'POST':
try {
bill = await createBill(bookingUUID, req.body)
res.status(200).json(bill)
} catch (e) {
log.error('Failed to store bill', e)
res.status(500).end(`Internal Server Error...Guru is meditating...`)
return
}
break
case 'PATCH':
try {
bill = await patchBill(bookingUUID, req.body)
res.status(200).json(bill)
} catch (e) {
log.error('Failed to patch bill', e)
res.status(500).end(`Internal Server Error...Guru is meditating...`)
return
}
break
default:
res.setHeader('Allow', ['POST', 'PATCH'])
res.status(405).end(`Method ${method} Not Allowed`)
}
}