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
File diff suppressed because it is too large.
Load diff
@@ -1,32 +1,13 @@
|
|||||||
import { fetchAdminList } from "@/lib/admin-list";
|
import { loadChatLogList } from "../_lib/load-ignored-logs";
|
||||||
import { PERMS } from "@/lib/permissions";
|
|
||||||
import { ChatTable } from "./chat-table";
|
import { ChatTable } from "./chat-table";
|
||||||
|
|
||||||
export default async function ChatLogsPage({
|
export default async function ChatLogsPage({
|
||||||
params: paramsPromise,
|
|
||||||
searchParams,
|
searchParams,
|
||||||
}: {
|
}: {
|
||||||
params: Promise<{ locale: string }>;
|
params: Promise<{ locale: string }>;
|
||||||
searchParams: Promise<Record<string, string>>;
|
searchParams: Promise<Record<string, string>>;
|
||||||
}) {
|
}) {
|
||||||
const result = await fetchAdminList(
|
const result = await loadChatLogList({ searchParams, defaultPerPage: 50 });
|
||||||
{
|
|
||||||
permission: PERMS.LOGS_VIEW,
|
|
||||||
model: "chatLog",
|
|
||||||
searchFields: ["message", "user.username"],
|
|
||||||
defaultPerPage: 50,
|
|
||||||
include: { user: { select: { username: true } } },
|
|
||||||
mapRow: (l) => ({
|
|
||||||
id: l.id,
|
|
||||||
username: l.user.username,
|
|
||||||
message: l.message,
|
|
||||||
timestamp: l.timestamp,
|
|
||||||
roomId: l.roomId,
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
paramsPromise,
|
|
||||||
searchParams,
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
|
|||||||
@@ -1,32 +1,13 @@
|
|||||||
import { fetchAdminList } from "@/lib/admin-list";
|
import { loadCommandLogList } from "../_lib/load-ignored-logs";
|
||||||
import { PERMS } from "@/lib/permissions";
|
|
||||||
import { CommandsTable } from "./commands-table";
|
import { CommandsTable } from "./commands-table";
|
||||||
|
|
||||||
export default async function CommandLogsPage({
|
export default async function CommandLogsPage({
|
||||||
params: paramsPromise,
|
|
||||||
searchParams,
|
searchParams,
|
||||||
}: {
|
}: {
|
||||||
params: Promise<{ locale: string }>;
|
params: Promise<{ locale: string }>;
|
||||||
searchParams: Promise<Record<string, string>>;
|
searchParams: Promise<Record<string, string>>;
|
||||||
}) {
|
}) {
|
||||||
const result = await fetchAdminList(
|
const result = await loadCommandLogList({ searchParams, defaultPerPage: 50 });
|
||||||
{
|
|
||||||
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,
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
|
|||||||
Reference in new issue
Block a user