Even more migrations
This commit is contained in:
@@ -18,18 +18,15 @@ export async function onRequestPost(context: RequestContext) {
|
|||||||
|
|
||||||
if (isNaN(parseInt(user))) return jsonError("Invalid user ID", 400);
|
if (isNaN(parseInt(user))) return jsonError("Invalid user ID", 400);
|
||||||
|
|
||||||
await context.env.D1.prepare(
|
await context.data.prisma.gameModLog.create({
|
||||||
"INSERT INTO game_mod_logs (action, evidence, executed_at, executor, id, target) VALUES (?, ?, ?, ?, ?, ?);",
|
data: {
|
||||||
)
|
action: "revoke",
|
||||||
.bind(
|
evidence: ticket_link,
|
||||||
"revoke",
|
executor: context.data.current_user.id,
|
||||||
ticket_link,
|
id: crypto.randomUUID(),
|
||||||
Date.now(),
|
target: parseInt(user),
|
||||||
context.data.current_user.id,
|
},
|
||||||
crypto.randomUUID(),
|
});
|
||||||
parseInt(user),
|
|
||||||
)
|
|
||||||
.run();
|
|
||||||
|
|
||||||
const { etag, value: banList } = await getBanList(context);
|
const { etag, value: banList } = await getBanList(context);
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,22 @@
|
|||||||
import { jsonError, jsonResponse } from "../../common.js";
|
import { jsonResponse } from "../../common.js";
|
||||||
|
|
||||||
export async function onRequestGet(context: RequestContext) {
|
export async function onRequestGet(context: RequestContext) {
|
||||||
const {
|
return jsonResponse(
|
||||||
results,
|
JSON.stringify(
|
||||||
success,
|
await context.data.prisma.report.findMany({
|
||||||
}: {
|
select: {
|
||||||
results: { id: string }[];
|
created_at: true,
|
||||||
success: boolean;
|
id: true,
|
||||||
} = await context.env.D1.prepare(
|
open: true,
|
||||||
"SELECT created_at, id, open, target_usernames FROM reports WHERE json_extract(user, '$.id') = ? ORDER BY created_at LIMIT 50;",
|
target_usernames: true,
|
||||||
)
|
},
|
||||||
.bind(context.data.current_user.id)
|
where: {
|
||||||
.all();
|
user: {
|
||||||
|
path: "id",
|
||||||
if (!success) return jsonError("Failed to retrieve reports", 500);
|
equals: context.data.current_user.id,
|
||||||
|
},
|
||||||
return jsonResponse(JSON.stringify(results));
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user