Merge pull request #143 from calcom/fix/missing-return-bookings-id

fix: bookings:id
pull/9078/head
Agusti Fernandez Pardo 2022-07-08 18:51:33 +02:00 committed by GitHub
commit 916ceb57c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -23,10 +23,9 @@ export async function bookingById(
});
if (!userWithBookings) throw new Error("User not found");
const userBookingIds = userWithBookings.bookings.map((booking: { id: number }) => booking.id).flat();
if (!isAdmin) {
if (!userBookingIds.includes(safeQuery.data.id)) res.status(401).json({ message: "Unauthorized" });
} else {
if (!isAdmin || !userBookingIds.includes(safeQuery.data.id))
res.status(401).json({ message: "Unauthorized" });
else {
switch (method) {
/**
* @swagger