마에스트로 상세 화면의 처리 로그 표에 페이지네이션 추가
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
import { getMaestroLogs } from "@/lib/maestros";
|
||||
import { ApiError } from "@/lib/errors";
|
||||
import { withApiHandler } from "@/lib/api-handler";
|
||||
|
||||
const CTX = "maestros/[id]/logs";
|
||||
|
||||
export const GET = withApiHandler<{ id: string }>(
|
||||
CTX,
|
||||
async (request, { params }) => {
|
||||
const { id } = await params;
|
||||
const maestroID = Number(id);
|
||||
|
||||
if (!Number.isInteger(maestroID) || maestroID <= 0) {
|
||||
throw new ApiError("Invalid maestro id", 400);
|
||||
}
|
||||
|
||||
const url = new URL(request.url);
|
||||
const result = await getMaestroLogs(maestroID, url.searchParams);
|
||||
|
||||
if (!result) {
|
||||
throw new ApiError("Not found", 404);
|
||||
}
|
||||
|
||||
return NextResponse.json(result);
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user