mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-03 06:27:11 +01:00
fix most type errors
still have a few things outstanding
This commit is contained in:
committed by
Thomas Ruoff
parent
c3d8c6f3e0
commit
90ac05a907
@@ -4,7 +4,7 @@ import Booker from './booker'
|
||||
import Booking from './booking'
|
||||
import { BOOKING_STATUS } from './bookingStatus'
|
||||
|
||||
let connectedPromise
|
||||
let connectedPromise: Promise<typeof mongoose>
|
||||
|
||||
function connect() {
|
||||
if (connectedPromise) {
|
||||
@@ -39,13 +39,13 @@ export async function getBookedDays() {
|
||||
.sort()
|
||||
}
|
||||
|
||||
export async function getBookingByUUID(uuid) {
|
||||
export async function getBookingByUUID(uuid: string) {
|
||||
await connect()
|
||||
const booking = await Booking.findOne({ uuid })
|
||||
return booking.populate('booker').execPopulate()
|
||||
}
|
||||
|
||||
export async function getBookingByUUIDAsJSON(uuid) {
|
||||
export async function getBookingByUUIDAsJSON(uuid: string) {
|
||||
const booking = await getBookingByUUID(uuid)
|
||||
return booking.toJSON()
|
||||
}
|
||||
@@ -66,7 +66,7 @@ export async function createBooking({
|
||||
const booking = new Booking({ startDate, endDate, purpose, org, destination })
|
||||
const bookedDays = await getBookedDays()
|
||||
|
||||
if (booking.days.some((day) => bookedDays.includes(day))) {
|
||||
if (booking.days.some((day: string) => bookedDays.includes(day))) {
|
||||
throw new mongoose.Error.ValidationError(booking)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user