feat(admin): Server Action'larla kullanıcı yönetimi ve gerçek oturumlu sayfalar
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import "server-only";
|
||||
import { headers } from "next/headers";
|
||||
import { getAuth } from "@/lib/auth";
|
||||
import { requireRole } from "@/lib/dal";
|
||||
import { toAdminUser } from "./mapper";
|
||||
import type { AdminUser } from "./types";
|
||||
|
||||
/** Admin: tüm kullanıcılar (en yeni önce). Kişisel kullanım ölçeğinde tek sayfa yeterli. */
|
||||
export async function listAdminUsers(): Promise<AdminUser[]> {
|
||||
await requireRole("admin");
|
||||
const result = await getAuth().api.listUsers({
|
||||
headers: await headers(),
|
||||
query: { limit: 1000, sortBy: "createdAt", sortDirection: "desc" },
|
||||
});
|
||||
return result.users.map(toAdminUser);
|
||||
}
|
||||
Reference in New Issue
Block a user