Migrate the rest of the easy stuff
This commit is contained in:
@@ -6,9 +6,11 @@ export async function onRequestDelete(context: RequestContext) {
|
||||
if (targetId.search(/^\d{16.19}$/) === -1)
|
||||
return jsonError("Invalid target id", 400);
|
||||
|
||||
await context.env.D1.prepare("DELETE FROM appeal_bans WHERE user = ?;")
|
||||
.bind(targetId)
|
||||
.run();
|
||||
await context.data.prisma.appealBan.delete({
|
||||
where: {
|
||||
user: targetId,
|
||||
},
|
||||
});
|
||||
|
||||
const { current_user: currentUser } = context.data;
|
||||
|
||||
@@ -46,11 +48,12 @@ export async function onRequestPost(context: RequestContext) {
|
||||
if (targetId.search(/^\d{16,19}$/) === -1)
|
||||
return jsonError("Invalid target id", 400);
|
||||
|
||||
await context.env.D1.prepare(
|
||||
"INSERT INTO appeal_bans (created_at, created_by, user) VALUES (?, ?, ?);",
|
||||
)
|
||||
.bind(Date.now(), context.data.current_user.id, targetId)
|
||||
.run();
|
||||
await context.data.prisma.appealBan.create({
|
||||
data: {
|
||||
created_by: context.data.current_user.id,
|
||||
user: targetId,
|
||||
},
|
||||
});
|
||||
|
||||
await fetch(context.env.APPEALS_WEBHOOK, {
|
||||
body: JSON.stringify({
|
||||
|
||||
Reference in New Issue
Block a user