Phase 4. 마에스트로 목록 화면 구현

This commit is contained in:
2026-06-10 22:22:45 +09:00
parent dbf9b3e180
commit fbe4caa9e1
8 changed files with 1226 additions and 4 deletions
+39
View File
@@ -0,0 +1,39 @@
import { NextResponse } from "next/server";
import { auth } from "@/auth";
import { getMaestroDetail } from "@/lib/maestros";
type MaestroDetailRouteContext = {
params: Promise<{
id: string;
}>;
};
export async function GET(
_request: Request,
{ params }: MaestroDetailRouteContext
) {
const session = await auth();
if (!session) {
return NextResponse.json({ message: "Unauthorized" }, { status: 401 });
}
const { id } = await params;
const maestroID = Number(id);
if (!Number.isInteger(maestroID) || maestroID <= 0) {
return NextResponse.json(
{ message: "Invalid maestro id" },
{ status: 400 }
);
}
const result = await getMaestroDetail(maestroID);
if (!result) {
return NextResponse.json({ message: "Not found" }, { status: 404 });
}
return NextResponse.json(result);
}
+17
View File
@@ -0,0 +1,17 @@
import { NextResponse } from "next/server";
import { auth } from "@/auth";
import { getMaestros } from "@/lib/maestros";
export async function GET(request: Request) {
const session = await auth();
if (!session) {
return NextResponse.json({ message: "Unauthorized" }, { status: 401 });
}
const url = new URL(request.url);
const result = await getMaestros(url.searchParams);
return NextResponse.json(result);
}