Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+21
@@ -0,0 +1,21 @@
|
||||
// CSV export for the admin audit log. Resource route on purpose: raw Response
|
||||
// bodies only pass through routes without a component.
|
||||
import type { LoaderFunctionArgs } from "react-router";
|
||||
import { getAdminAuditLogList, serializeAdminAuditLogsCsv } from "@hivegrid/db/logs.server";
|
||||
import { verifyUserHasPermission } from "~/utils/helpers/.server/PermissionsService";
|
||||
import { CSV_EXPORT_TAKE, getAdminAuditLogFiltersFromUrl } from "./audit-trails.helpers.server";
|
||||
|
||||
export const loader = async ({ request }: LoaderFunctionArgs) => {
|
||||
await verifyUserHasPermission(request, "admin.auditTrails.view");
|
||||
|
||||
const urlSearchParams = new URL(request.url).searchParams;
|
||||
const auditLogFilters = getAdminAuditLogFiltersFromUrl(urlSearchParams);
|
||||
const { rows } = await getAdminAuditLogList({ ...auditLogFilters, take: CSV_EXPORT_TAKE, skip: 0 });
|
||||
|
||||
return new Response(serializeAdminAuditLogsCsv(rows), {
|
||||
headers: {
|
||||
"Content-Type": "text/csv; charset=utf-8",
|
||||
"Content-Disposition": 'attachment; filename="admin-audit-logs.csv"',
|
||||
},
|
||||
});
|
||||
};
|
||||
Reference in new issue
Block a user