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