mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-04 06:57:12 +01:00
further work on bills
This commit is contained in:
committed by
Thomas Ruoff
parent
ec1b2e9629
commit
f8434233d9
@@ -86,12 +86,15 @@ export async function createBooking({
|
||||
|
||||
export async function createBill(bookingUUID: string, billData: BillDocument) {
|
||||
await connect()
|
||||
const bill = new Bill(billData)
|
||||
|
||||
const booking = await getBookingByUUID(bookingUUID)
|
||||
bill.booking = booking._id
|
||||
const bill =
|
||||
(await Bill.findOne({ booking: booking._id })) ||
|
||||
new Bill({ booking: booking._id })
|
||||
|
||||
bill.set(billData)
|
||||
|
||||
await bill.save()
|
||||
await bill.populate('booking').execPopulate()
|
||||
|
||||
return bill.toJSON()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user