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:
@@ -35,18 +35,3 @@ export function checkAdminAction(action: AdminAction, ctx: GuardContext): GuardV
|
||||
if (removesAdmin && ctx.adminCount <= 1) return "lastAdmin";
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Kullanıcı adı / e-posta benzersizlik kontrolü (normalize edilmiş değerlerle). */
|
||||
export function findUniqueConflicts(
|
||||
users: ReadonlyArray<{ id: string; username: string; email?: string }>,
|
||||
values: { username: string; email?: string },
|
||||
excludeId?: string,
|
||||
): { username?: "taken"; email?: "taken" } {
|
||||
const others = users.filter((u) => u.id !== excludeId);
|
||||
return {
|
||||
...(others.some((u) => u.username === values.username) ? { username: "taken" as const } : {}),
|
||||
...(values.email && others.some((u) => u.email === values.email)
|
||||
? { email: "taken" as const }
|
||||
: {}),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user