feat(admin): add user account management

This commit is contained in:
dmg
2026-08-01 14:16:46 -04:00
parent c5de0a1810
commit 10554eeaff
10 changed files with 690 additions and 6 deletions
+17
View File
@@ -5,6 +5,23 @@ import { db } from "@/lib/database";
const UI_ACCESSED = "games.minecraft.account-manager.ui.accessed";
export async function recordAdminEvent(
admin: { email: string | null; name: string | null },
targetUserId: string,
type: string,
data: Record<string, unknown>,
) {
const requestHeaders = await headers();
const ipAddress = getClientIp(requestHeaders, process.env.TRUST_PROXY === "true");
return recordEvent(db, {
type,
source: "/web/admin",
subject: `user/${targetUserId}`,
ipAddress: ipAddress ?? undefined,
data: { ...data, adminEmail: admin.email, adminName: admin.name },
});
}
export async function recordUserEvent(
user: { id: string },
type: string,