fix: adds returns, no breaks
parent
13d013bdf8
commit
6b09fb24ab
|
@ -62,7 +62,6 @@ export async function bookingById(
|
|||
error,
|
||||
})
|
||||
);
|
||||
break;
|
||||
/**
|
||||
* @swagger
|
||||
* /bookings/{id}:
|
||||
|
@ -110,12 +109,12 @@ export async function bookingById(
|
|||
res.status(400).json({ message: "Bad request", error: safeBody.error });
|
||||
return;
|
||||
}
|
||||
await prisma.booking
|
||||
return await prisma.booking
|
||||
.update({
|
||||
where: { id: safeQuery.data.id },
|
||||
data: safeBody.data,
|
||||
})
|
||||
// .then((data) => schemaBookingReadPublic.parse(data))
|
||||
.then((data) => schemaBookingReadPublic.parse(data))
|
||||
.then((booking) => res.status(200).json({ booking }))
|
||||
.catch((error: Error) =>
|
||||
res.status(404).json({
|
||||
|
@ -123,7 +122,6 @@ export async function bookingById(
|
|||
error,
|
||||
})
|
||||
);
|
||||
break;
|
||||
/**
|
||||
* @swagger
|
||||
* /bookings/{id}:
|
||||
|
@ -148,7 +146,7 @@ export async function bookingById(
|
|||
* description: Authorization information is missing or invalid.
|
||||
*/
|
||||
case "DELETE":
|
||||
await prisma.booking
|
||||
return await prisma.booking
|
||||
.delete({ where: { id: safeQuery.data.id } })
|
||||
.then(() =>
|
||||
res.status(200).json({
|
||||
|
@ -161,13 +159,11 @@ export async function bookingById(
|
|||
error,
|
||||
})
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
res.status(405).json({ message: "Method not allowed" });
|
||||
break;
|
||||
return res.status(405).json({ message: "Method not allowed" });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default withMiddleware("HTTP_GET_DELETE_PATCH")(bookingById);
|
||||
export default withMiddleware("HTTP_GET_DELETE_PATCH")(withValidQueryIdTransformParseInt(bookingById));
|
||||
|
|
Loading…
Reference in New Issue