Get almost everything else
This commit is contained in:
@@ -14,11 +14,12 @@ export async function onRequestPost(context: RequestContext) {
|
||||
fcm_token,
|
||||
);
|
||||
|
||||
await context.env.D1.prepare(
|
||||
"DELETE FROM push_notifications WHERE event_id = ? AND event_type = 'appeal';",
|
||||
)
|
||||
.bind(appeal.id)
|
||||
.run();
|
||||
await context.data.prisma.pushNotification.delete({
|
||||
where: {
|
||||
event_id: appeal.id,
|
||||
event_type: "appeal",
|
||||
},
|
||||
});
|
||||
} else {
|
||||
const emailResponse = await sendEmail(
|
||||
appeal.user.email,
|
||||
@@ -36,11 +37,8 @@ export async function onRequestPost(context: RequestContext) {
|
||||
}
|
||||
}
|
||||
|
||||
await context.env.D1.prepare(
|
||||
"UPDATE appeals SET approved = 0, user = json_remove(user, '$.email') WHERE id = ?;",
|
||||
)
|
||||
.bind(context.params.id)
|
||||
.run();
|
||||
await context.data.prisma
|
||||
.$executeRaw`UPDATE appeals SET approved = FALSE, user = json_remove(user, '$.id') WHERE id = ${appeal.id};`;
|
||||
|
||||
const { current_user: currentUser } = context.data;
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { jsonResponse } from "../../common.js";
|
||||
|
||||
export async function onRequestGet(context: RequestContext) {
|
||||
const { results } = await context.env.D1.prepare(
|
||||
"SELECT * FROM appeal_bans ORDER BY created_by DESC;",
|
||||
).all();
|
||||
const results = await context.data.prisma.appealBan.findMany({
|
||||
orderBy: {
|
||||
created_at: "desc",
|
||||
},
|
||||
});
|
||||
|
||||
return jsonResponse(JSON.stringify(results));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user