refactor(housekeeping): modal confirm, bulk delete, search debounce, audit inline, form reset
Local Build and Deploy / deploy (push) Successful in 1m6s
Local Build and Deploy / deploy (push) Successful in 1m6s
- Replace browser confirm() with custom ConfirmModal component - Add search debounce (300ms) before syncing URL params - Reset add-permission form after successful submit - Add bulk select/delete with checkbox column and bulkDeletePermissions action - AuditSection fetches logs server-side via getAuditLogs and shows inline table - Add 10 new i18n keys (cancel, confirm, confirmDeletePermission, confirmBulkDelete, deleteSelected, confirmClearAllDesc, auditTime, auditUser, auditAction, auditTarget) synced to all 22 locales
This commit is contained in:
1 parent
d693d169dd
commit
f1e4e32a1e
25 files changed
+645
-137
No files matched your search
@@ -870,4 +870,27 @@ export async function clearAllPermissions(): Promise<void> {
|
||||
revalidatePath("/admin/housekeeping");
|
||||
}
|
||||
|
||||
export async function bulkDeletePermissions(
|
||||
ids: bigint[],
|
||||
): Promise<{ count: number }> {
|
||||
await requirePermission(PERMS.SETTINGS_EDIT);
|
||||
|
||||
if (!ids.length) return { count: 0 };
|
||||
|
||||
const userId = await currentUserId();
|
||||
|
||||
await prisma.websiteHousekeepingPermissions.deleteMany({
|
||||
where: { id: { in: ids } },
|
||||
});
|
||||
|
||||
await logAudit({
|
||||
userId: userId ?? 0,
|
||||
action: "housekeeping.permission.bulk_delete",
|
||||
target: "WebsiteHousekeepingPermissions",
|
||||
after: { deletedCount: ids.length },
|
||||
});
|
||||
|
||||
revalidatePath("/admin/housekeeping");
|
||||
return { count: ids.length };
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user