AeThex-OS/temp-forge-extract/aethex-forge-main/api/staff/directory.ts
MrPiglr b3c308b2c8 Add functional marketplace modules, bottom nav bar, root terminal, arcade games
- ModuleManager: Central tracking for installed marketplace modules
- DataAnalyzerWidget: Real-time CPU/RAM/Battery/Storage widget (unlocked by Data Analyzer module)
- BottomNavBar: Navigation bar for Projects/Chat/Marketplace/Settings
- RootShell: Real root command execution utility
- TerminalActivity: Full root shell with neofetch, sysinfo, real Linux commands
- Terminal Pro module: Adds aliases (ll, la, h), command history
- ArcadeActivity + SnakeGame: Pixel Arcade module unlocks retro games
- fade_in/fade_out animations for smooth transitions
2026-02-18 22:03:50 -07:00

54 lines
1.3 KiB
TypeScript

import { supabase } from "../_supabase.js";
export default async (req: Request) => {
if (req.method !== "GET") {
return new Response("Method not allowed", { status: 405 });
}
try {
const token = req.headers.get("Authorization")?.replace("Bearer ", "");
if (!token) {
return new Response("Unauthorized", { status: 401 });
}
const { data: userData } = await supabase.auth.getUser(token);
if (!userData.user) {
return new Response("Unauthorized", { status: 401 });
}
const { data: directory, error } = await supabase
.from("staff_members")
.select(
`
id,
user_id,
full_name,
email,
role,
department,
employment_type,
avatar_url,
phone,
location,
username,
created_at
`,
)
.order("full_name", { ascending: true });
if (error) {
console.error("Directory fetch error:", error);
return new Response(JSON.stringify({ error: error.message }), {
status: 500,
});
}
return new Response(JSON.stringify(directory || []), {
headers: { "Content-Type": "application/json" },
});
} catch (err: any) {
return new Response(JSON.stringify({ error: err.message }), {
status: 500,
});
}
};