2035f73e7d
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
17 lines
618 B
TypeScript
17 lines
618 B
TypeScript
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);
|
||
}
|