fix: bookings:id fix bad isAdmin double if adding missing return replace with || OR instead
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user