mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-03 06:27:11 +01:00
default to max milage found for a new bill
This commit is contained in:
10
db/index.ts
10
db/index.ts
@@ -28,7 +28,6 @@ export async function getBookedDays() {
|
||||
export async function getBookingByUUID(uuid: string) {
|
||||
await connect()
|
||||
return Booking.findOne({ uuid })
|
||||
//return booking.populate('bill').populate('booker').execPopulate()
|
||||
}
|
||||
|
||||
export async function getBookings() {
|
||||
@@ -116,3 +115,12 @@ export async function patchBill(bookingUUID: string, billData: BillDocument) {
|
||||
|
||||
return bill.toJSON()
|
||||
}
|
||||
|
||||
export async function getMilageMax(): Promise<number> {
|
||||
const billMaxMilageEnd = await Bill.findOne({})
|
||||
.sort('-milageEnd')
|
||||
.select('milageEnd')
|
||||
.exec()
|
||||
|
||||
return billMaxMilageEnd?.milageEnd
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user