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 { 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">
|
||||||
|
|||||||
@@ -1,35 +1,13 @@
|
|||||||
import { fetchAdminList } from "@/lib/admin-list";
|
import { loadTradeLogList } from "../_lib/load-ignored-logs";
|
||||||
import { PERMS } from "@/lib/permissions";
|
|
||||||
import { TradesTable } from "./trades-table";
|
import { TradesTable } from "./trades-table";
|
||||||
|
|
||||||
export default async function TradeLogsPage({
|
export default async function TradeLogsPage({
|
||||||
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 loadTradeLogList({ searchParams, defaultPerPage: 50 });
|
||||||
{
|
|
||||||
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,
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
|
|||||||
Reference in new issue
Block a user