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,27 @@
|
||||
import { visibleEmail } from "@/shared/account-email";
|
||||
import type { AdminUser } from "./types";
|
||||
|
||||
type RawAdminUser = {
|
||||
id: string;
|
||||
name: string;
|
||||
email: string;
|
||||
username?: string | null;
|
||||
role?: string | null;
|
||||
banned?: boolean | null;
|
||||
banReason?: string | null;
|
||||
createdAt: Date | string;
|
||||
};
|
||||
|
||||
/** Better Auth kullanıcı kaydını arayüz satırına çevirir (yer tutucu e-posta gizlenir). */
|
||||
export function toAdminUser(u: RawAdminUser): AdminUser {
|
||||
return {
|
||||
id: u.id,
|
||||
name: u.name,
|
||||
username: u.username ?? "",
|
||||
email: visibleEmail(u.email),
|
||||
role: u.role === "admin" ? "admin" : "user",
|
||||
banned: Boolean(u.banned),
|
||||
banReason: u.banReason ?? undefined,
|
||||
createdAt: new Date(u.createdAt).toISOString(),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user