Fix admin chat/command logs crashing on missing Prisma models.
chatlogs_room and commandlogs are @@ignore (no client delegates); load them via raw SQL with user joins instead of fetchAdminList(chatLog/commandLog). Co-authored-by: Cursor <[email protected]>
This commit is contained in:
1 parent
ef0d673cfe
commit
afeabdad1b
3 files changed
+164
-42
No files matched your search
@@ -1,32 +1,13 @@
|
||||
import { fetchAdminList } from "@/lib/admin-list";
|
||||
import { PERMS } from "@/lib/permissions";
|
||||
import { loadCommandLogList } from "../_lib/load-ignored-logs";
|
||||
import { CommandsTable } from "./commands-table";
|
||||
|
||||
export default async function CommandLogsPage({
|
||||
params: paramsPromise,
|
||||
searchParams,
|
||||
}: {
|
||||
params: Promise<{ locale: string }>;
|
||||
searchParams: Promise<Record<string, string>>;
|
||||
}) {
|
||||
const result = await fetchAdminList(
|
||||
{
|
||||
permission: PERMS.LOGS_VIEW,
|
||||
model: "commandLog",
|
||||
searchFields: ["command", "params", "user.username"],
|
||||
defaultPerPage: 50,
|
||||
include: { user: { select: { username: true } } },
|
||||
mapRow: (l) => ({
|
||||
id: l.id,
|
||||
username: l.user.username,
|
||||
command: l.command,
|
||||
params: l.params,
|
||||
timestamp: l.timestamp,
|
||||
}),
|
||||
},
|
||||
paramsPromise,
|
||||
searchParams,
|
||||
);
|
||||
const result = await loadCommandLogList({ searchParams, defaultPerPage: 50 });
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
|
||||
Reference in new issue
Block a user