refactor(admin-permissions, reports): normalize admin account kind and improve currency fallback logic
Some checks failed
lotteryadmin CI / build (push) Has been cancelled

Refactored the admin account kind resolution to utilize a normalization function for better consistency across the application. Updated the currency fallback logic in the reports console to prioritize enabled and bettable currencies, enhancing the accuracy of currency display.
This commit is contained in:
2026-06-16 17:15:06 +08:00
parent b924496a26
commit 7224d044ae
4 changed files with 33 additions and 13 deletions

View File

@@ -1,3 +1,4 @@
import { normalizeAdminAccountKind } from "@/lib/admin-account-kind";
import {
adminHasAnyPermission,
adminHasAnyPermissionCode,
@@ -10,8 +11,9 @@ export function resolveAdminAccountKind(profile: AdminProfile | null | undefined
if (!profile) {
return null;
}
if (profile.account_kind) {
return profile.account_kind === "site_operator" ? "site_admin" : profile.account_kind;
const normalized = normalizeAdminAccountKind(profile.account_kind);
if (normalized) {
return normalized;
}
if (profile.is_super_admin) {
return "super_admin";