23 lines
585 B
TypeScript
Executable File
23 lines
585 B
TypeScript
Executable File
import { sql } from "drizzle-orm";
|
|
import { db } from "@/lib/db";
|
|
import { auditLog, user } from "@/lib/db/schema";
|
|
import AuditLogViewer from "./client";
|
|
|
|
export default async function AuditLogViewerPage() {
|
|
const logs = (await db.execute(sql`
|
|
SELECT *
|
|
FROM (
|
|
SELECT *
|
|
FROM ${auditLog}
|
|
ORDER BY ${auditLog.id} DESC
|
|
LIMIT 1000
|
|
) t
|
|
ORDER BY id ASC;
|
|
`)) as (typeof auditLog.$inferSelect)[];
|
|
const users = await db
|
|
.select({ name: user.name, email: user.email })
|
|
.from(user);
|
|
|
|
return <AuditLogViewer logs={logs} users={users} />;
|
|
}
|