summaryrefslogtreecommitdiff
path: root/app/api
diff options
context:
space:
mode:
Diffstat (limited to 'app/api')
-rw-r--r--app/api/auth/[...nextauth]/saml/provider.ts3
-rw-r--r--app/api/menu-assignments/active-status/route.ts32
2 files changed, 34 insertions, 1 deletions
diff --git a/app/api/auth/[...nextauth]/saml/provider.ts b/app/api/auth/[...nextauth]/saml/provider.ts
index dfe3d830..761c06f1 100644
--- a/app/api/auth/[...nextauth]/saml/provider.ts
+++ b/app/api/auth/[...nextauth]/saml/provider.ts
@@ -97,7 +97,8 @@ export function SAMLProvider(options: SAMLProviderOptions) {
name: userData.name,
companyId: undefined,
techCompanyId: undefined,
- domain: userData.domain
+ domain: 'pending',
+ deptName:userData.deptName
};
debugLog('User create data:', userCreateData);
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