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 { await requireRole("admin"); const result = await getAuth().api.listUsers({ headers: await headers(), query: { limit: 1000, sortBy: "createdAt", sortDirection: "desc" }, }); return result.users.map(toAdminUser); }