Merge pull request 'fix(admin): chat/command logs crash on ignored Prisma models' (#13) from fix/admin-chat-command-logs into main
Local Build and Deploy / deploy (push) Successful in 59s
Local Build and Deploy / deploy (push) Successful in 59s
Reviewed-on: #13
This commit is contained in:
commit
57c3fe601a
4 files changed
+237
-66
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 { PERMS } from "@/lib/permissions";
|
||||
import { loadChatLogList } from "../_lib/load-ignored-logs";
|
||||
import { ChatTable } from "./chat-table";
|
||||
|
||||
export default async function ChatLogsPage({
|
||||
params: paramsPromise,
|
||||
searchParams,
|
||||
}: {
|
||||
params: Promise<{ locale: string }>;
|
||||
searchParams: Promise<Record<string, string>>;
|
||||
}) {
|
||||
const result = await fetchAdminList(
|
||||
{
|
||||
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,
|
||||
);
|
||||
const result = await loadChatLogList({ searchParams, defaultPerPage: 50 });
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -1,35 +1,13 @@
|
||||
import { fetchAdminList } from "@/lib/admin-list";
|
||||
import { PERMS } from "@/lib/permissions";
|
||||
import { loadTradeLogList } from "../_lib/load-ignored-logs";
|
||||
import { TradesTable } from "./trades-table";
|
||||
|
||||
export default async function TradeLogsPage({
|
||||
params: paramsPromise,
|
||||
searchParams,
|
||||
}: {
|
||||
params: Promise<{ locale: string }>;
|
||||
searchParams: Promise<Record<string, string>>;
|
||||
}) {
|
||||
const result = await fetchAdminList(
|
||||
{
|
||||
permission: PERMS.LOGS_VIEW,
|
||||
model: "trade",
|
||||
searchFields: ["userOne.username", "userTwo.username"],
|
||||
defaultPerPage: 50,
|
||||
include: {
|
||||
userOne: { select: { username: true } },
|
||||
userTwo: { select: { username: true } },
|
||||
},
|
||||
mapRow: (t) => ({
|
||||
id: t.id,
|
||||
userOneName: t.userOne.username,
|
||||
userTwoName: t.userTwo.username,
|
||||
status: t.status,
|
||||
timestamp: t.timestamp,
|
||||
}),
|
||||
},
|
||||
paramsPromise,
|
||||
searchParams,
|
||||
);
|
||||
const result = await loadTradeLogList({ searchParams, defaultPerPage: 50 });
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
|
||||
Reference in new issue
Block a user