fix type errors hopefully *fingerscrossed*

This commit is contained in:
Thomas Ruoff
2020-12-23 16:49:43 +01:00
parent 01dbe7a7bb
commit b723fc5660
3 changed files with 22 additions and 12 deletions

View File

@@ -72,14 +72,11 @@ export async function createBooking({
bookedDays.includes(day)
)
if (doubleBookedDays.length) {
const error = new mongoose.Error.ValidationError(booking)
error.addError(
'days',
new mongoose.Error.ValidatorError({
message: `${doubleBookedDays
.map((dateString) => dateFormatFrontend(new Date(dateString)))
.join(', ')} schon gebucht`,
})
const error = new mongoose.Error.ValidationError(booking.uuid)
error.errors.days = new mongoose.Error.ValidatorError(
`${doubleBookedDays
.map((dateString) => dateFormatFrontend(new Date(dateString)))
.join(', ')} schon gebucht`
)
throw error
}