diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-06-30 08:28:13 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-06-30 08:28:13 +0000 |
| commit | 5b6313f16f508882a0ea67716b7dbaa1c6967f04 (patch) | |
| tree | 3d1d8dafea2f31274ace3fbda08333e889e06d1c /app/api/menu-assignments | |
| parent | 3f0fad18483a5c800c79c5e33946d9bb384c10e2 (diff) | |
(대표님) 20250630 16시 - 유저 도메인별 라우터 분리와 보안성검토 대응
Diffstat (limited to 'app/api/menu-assignments')
| -rw-r--r-- | app/api/menu-assignments/active-status/route.ts | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/app/api/menu-assignments/active-status/route.ts b/app/api/menu-assignments/active-status/route.ts new file mode 100644 index 00000000..bd31e6b8 --- /dev/null +++ b/app/api/menu-assignments/active-status/route.ts @@ -0,0 +1,32 @@ +// app/api/menu-assignments/active-status/route.ts + +import { NextResponse } from "next/server" +import db from "@/db/db" +import { menuAssignments } from "@/db/schema" +import { eq } from "drizzle-orm" + +export async function GET() { + try { + // 모든 메뉴의 활성 상태를 조회 + const menus = await db + .select({ + menuPath: menuAssignments.menuPath, + isActive: menuAssignments.isActive, + }) + .from(menuAssignments) + + // 객체 형태로 변환 { "/evcp/menu-path": true, "/evcp/other-path": false } + const activeMenusMap = menus.reduce((acc, menu) => { + acc[menu.menuPath] = menu.isActive + return acc + }, {} as Record<string, boolean>) + + return NextResponse.json(activeMenusMap) + } catch (error) { + console.error("Error fetching menu active status:", error) + return NextResponse.json( + { error: "Failed to fetch menu status" }, + { status: 500 } + ) + } +}
\ No newline at end of file |
