Fixed signature

pull/375/head
nicolas 2021-07-15 23:34:55 +02:00
parent daecc1e0e4
commit b146b80778
2 changed files with 23 additions and 26 deletions

View File

@ -498,7 +498,9 @@ const calendars = (withCredentials): CalendarApiAdapter[] =>
.filter(Boolean);
const getBusyCalendarTimes = (withCredentials, dateFrom, dateTo, selectedCalendars) =>
Promise.all(calendars(withCredentials).map((c) => c.getAvailability(selectedCalendars))).then((results) => {
Promise.all(
calendars(withCredentials).map((c) => c.getAvailability(dateFrom, dateTo, selectedCalendars))
).then((results) => {
return results.reduce((acc, availability) => acc.concat(availability), []);
});

View File

@ -1,6 +1,6 @@
import prisma from '../../lib/prisma';
import prisma from "../../lib/prisma";
import { deleteEvent } from "../../lib/calendarClient";
import async from 'async';
import async from "async";
import { deleteMeeting } from "../../lib/videoClient";
export default async function handler(req, res) {
@ -15,17 +15,17 @@ export default async function handler(req, res) {
id: true,
user: {
select: {
credentials: true
}
credentials: true,
},
},
attendees: true,
references: {
select: {
uid: true,
type: true
}
}
}
type: true,
},
},
},
});
const apiDeletes = async.mapLimit(bookingToDelete.user.credentials, 5, async (credential) => {
@ -38,13 +38,13 @@ export default async function handler(req, res) {
});
const attendeeDeletes = prisma.attendee.deleteMany({
where: {
bookingId: bookingToDelete.id
}
bookingId: bookingToDelete.id,
},
});
const bookingReferenceDeletes = prisma.bookingReference.deleteMany({
where: {
bookingId: bookingToDelete.id
}
bookingId: bookingToDelete.id,
},
});
const bookingDeletes = prisma.booking.delete({
where: {
@ -52,17 +52,12 @@ export default async function handler(req, res) {
},
});
await Promise.all([
apiDeletes,
attendeeDeletes,
bookingReferenceDeletes,
bookingDeletes
]);
await Promise.all([apiDeletes, attendeeDeletes, bookingReferenceDeletes, bookingDeletes]);
//TODO Perhaps send emails to user and client to tell about the cancellation
res.status(200).json({message: 'Booking successfully deleted.'});
res.status(200).json({ message: "Booking successfully deleted." });
} else {
res.status(405).json({message: 'This endpoint only accepts POST requests.'});
res.status(405).json({ message: "This endpoint only accepts POST requests." });
}
}