Migrate the rest of the easy stuff
This commit is contained in:
@@ -20,31 +20,31 @@ export async function onRequestPost(context: RequestContext) {
|
||||
(context.request.headers.get("cf-ray") as string).split("-")[0] +
|
||||
Date.now().toString();
|
||||
|
||||
await context.env.D1.prepare(
|
||||
"INSERT INTO inactivity_notices (created_at, departments, end, hiatus, id, reason, start, user) VALUES (?, ?, ?, ?, ?, ?, ?, ?);",
|
||||
)
|
||||
.bind(
|
||||
Date.now(),
|
||||
JSON.stringify(departments),
|
||||
await context.data.prisma.inactivityNotice.create({
|
||||
data: {
|
||||
decisions: {},
|
||||
departments,
|
||||
end,
|
||||
typeof hiatus === "boolean" ? Number(hiatus) : 0,
|
||||
inactivityId,
|
||||
hiatus,
|
||||
id: inactivityId,
|
||||
reason,
|
||||
start,
|
||||
JSON.stringify({
|
||||
user: {
|
||||
id: context.data.current_user.id,
|
||||
email: context.data.current_user.email,
|
||||
username: context.data.current_user.username,
|
||||
}),
|
||||
)
|
||||
.run();
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
if (typeof senderTokenId === "string") {
|
||||
await context.env.D1.prepare(
|
||||
"INSERT INTO push_notifications (created_at, event_id, event_type) VALUES (?, ?, ?);",
|
||||
)
|
||||
.bind(Date.now(), inactivityId, "inactivity")
|
||||
.run();
|
||||
await context.data.prisma.pushNotification.create({
|
||||
data: {
|
||||
event_id: inactivityId,
|
||||
event_type: "inactivity",
|
||||
token: senderTokenId,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const departmentsToNotify = [];
|
||||
|
||||
Reference in New Issue
Block a user