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