2023-12-20 17:23:31 -05:00
|
|
|
import { messages } from "@server/constants";
|
|
|
|
import { Band } from "@models/band";
|
2023-10-03 00:48:41 -04:00
|
|
|
|
|
|
|
export default eventHandler(async (ev) => {
|
|
|
|
const id = parseInt(getRouterParam(ev, "id") as string);
|
|
|
|
const band = await Band.findById(id).exec();
|
|
|
|
|
2023-12-06 22:22:48 -05:00
|
|
|
if (!band) {
|
|
|
|
throw createError({
|
|
|
|
statusCode: 404,
|
|
|
|
message: messages[404],
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
return band.toObject();
|
2023-10-03 00:48:41 -04:00
|
|
|
});
|