prisma 성공~

This commit is contained in:
wallace
2025-11-11 11:41:08 +09:00
parent 6600241bdb
commit 137edf2d0d
6 changed files with 90 additions and 14 deletions

30
app/api/test/route.ts Normal file
View File

@@ -0,0 +1,30 @@
import { PrismaClient } from "@/lib/generated/prisma/client";
import { NextResponse } from "next/server";
const prisma = new PrismaClient();
export async function GET() {
try {
const tests = await prisma.test.findMany();
return NextResponse.json(tests);
} catch (error) {
console.error(error);
return NextResponse.json({ error: "Failed to fetch tests." }, { status: 500 });
}
}
export async function POST(req: Request) {
try {
const body = await req.json();
const { name } = body;
if (!name) {
return NextResponse.json({ error: "Name is required." }, { status: 400 });
}
const test = await prisma.test.create({
data: { name },
});
return NextResponse.json(test, { status: 201 });
} catch (error) {
return NextResponse.json({ error: "Failed to create test." }, { status: 500 });
}
}

View File

@@ -69,40 +69,56 @@ export default function HomePage() {
return (
<div className="bg-white relative min-h-screen w-full">
{/* 헤더 */}
<header className="absolute content-stretch flex items-center justify-between left-[calc(12.5%+91.375px)] top-[43px] w-[1332px]">
<header className="absolute content-stretch flex items-center justify-between left-[332px] top-[43px] w-[1332px]">
<div className="content-stretch flex gap-[99px] items-center relative shrink-0">
{/* 로고 */}
<button
onClick={() => router.push('/')}
className="h-[74px] relative shrink-0 w-[72px] cursor-pointer"
>
<div className="absolute inset-0 overflow-hidden pointer-events-none">
<img alt="" className="absolute h-[291.74%] left-[-100%] max-w-none top-[-95.73%] w-[301.18%]" src={imgImage2} />
</div>
<Image
src={logo}
alt="로고"
className="w-full h-full object-contain"
width={72}
height={74}
/>
</button>
{/* 메뉴 */}
<div className="content-stretch flex gap-[24px] items-center relative shrink-0">
<div className="content-stretch flex gap-[150px] items-center relative shrink-0">
<button
onClick={() => router.push('/lecturelist')}
className="content-stretch flex gap-[150px] items-center relative shrink-0 cursor-pointer group transition-colors"
>
<div className="box-border content-stretch flex gap-[10px] items-center justify-center p-[10px] relative shrink-0">
<p className="font-bold leading-[normal] not-italic relative shrink-0 text-[#515151] text-[24px] text-nowrap whitespace-pre">
<p className="font-bold leading-[normal] not-italic relative shrink-0 text-[#515151] text-[24px] text-nowrap whitespace-pre group-hover:text-blue-500 transition-colors">
</p>
</div>
</div>
<div className="content-stretch flex gap-[150px] items-center relative shrink-0">
</button>
<button
onClick={() => router.push('/studydata')}
className="content-stretch flex gap-[150px] items-center relative shrink-0 cursor-pointer group transition-colors"
>
<div className="box-border content-stretch flex gap-[10px] items-center justify-center p-[10px] relative shrink-0">
<p className="font-bold leading-[normal] not-italic relative shrink-0 text-[#515151] text-[24px] text-nowrap whitespace-pre">
<p className="font-bold leading-[normal] not-italic relative shrink-0 text-[#515151] text-[24px] text-nowrap whitespace-pre group-hover:text-blue-500 transition-colors">
</p>
</div>
</div>
<div className="content-stretch flex gap-[150px] items-center relative shrink-0">
</button>
<button
onClick={() => {
// 공지사항 섹션으로 스크롤
window.scrollTo({ top: 1213, behavior: 'smooth' });
}}
className="content-stretch flex gap-[150px] items-center relative shrink-0 cursor-pointer group transition-colors"
>
<div className="box-border content-stretch flex gap-[10px] items-center justify-center p-[10px] relative shrink-0">
<p className="font-bold leading-[normal] not-italic relative shrink-0 text-[#515151] text-[24px] text-nowrap whitespace-pre">
<p className="font-bold leading-[normal] not-italic relative shrink-0 text-[#515151] text-[24px] text-nowrap whitespace-pre group-hover:text-blue-500 transition-colors">
</p>
</div>
</div>
</button>
</div>
</div>
{/* 사용자 메뉴 */}
@@ -131,7 +147,7 @@ export default function HomePage() {
</header>
{/* 구분선 */}
<div className="absolute h-0 left-[calc(50%+0.5px)] top-[150px] translate-x-[-50%] w-full">
<div className="absolute h-0 left-1/2 top-[150px] translate-x-[-50%] w-[1920px]">
<div className="absolute bottom-0 left-0 right-0 top-[-1px]">
<img alt="" className="block max-w-none size-full" src={imgLine2} />
</div>

0
app/studydata/page.tsx Normal file
View File