mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-03 06:27:11 +01:00
no need to use faulty regex in booker finding
This commit is contained in:
10
db/index.js
10
db/index.js
@@ -38,6 +38,13 @@ export async function getBookedDays() {
|
||||
.sort()
|
||||
}
|
||||
|
||||
export async function getBookingByUUID(uuid) {
|
||||
await connect()
|
||||
const booking = await Booking.findOne({ uuid })
|
||||
await booking.populate('booker').execPopulate()
|
||||
return booking
|
||||
}
|
||||
|
||||
export async function createBooking({
|
||||
startDate,
|
||||
endDate,
|
||||
@@ -58,8 +65,7 @@ export async function createBooking({
|
||||
throw new mongoose.Error.ValidationError(booking)
|
||||
}
|
||||
|
||||
const ignoreCaseEmailMatcher = new RegExp(email, 'i')
|
||||
let booker = await Booker.findOne({ email: ignoreCaseEmailMatcher }).exec()
|
||||
let booker = await Booker.findOne({ email }).exec()
|
||||
if (!booker) {
|
||||
booker = new Booker({ name, email, street, zip, city })
|
||||
await booker.save()
|
||||
|
||||
Reference in New Issue
Block a user