Fix admin trade logs: wrong Prisma model and missing relations.
Load room_trade_log via SQL with user joins; status is always completed (no column in DB). Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -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