17 lines
355 B
TypeScript
17 lines
355 B
TypeScript
import { messages } from "@server/constants";
|
|
import { Band } from "@models/band";
|
|
|
|
export default eventHandler(async (ev) => {
|
|
const id = parseInt(getRouterParam(ev, "id") as string);
|
|
const band = await Band.findById(id).exec();
|
|
|
|
if (!band) {
|
|
throw createError({
|
|
statusCode: 404,
|
|
message: messages[404],
|
|
});
|
|
}
|
|
|
|
return band.toObject();
|
|
});
|