Migrate the rest of the easy stuff
All checks were successful
Test, Build, Deploy / Test, Build, and Deploy (push) Successful in 58s
Test, Build, Deploy / Create Sentry Release (push) Successful in 6s

This commit is contained in:
2026-04-11 04:32:09 -04:00
parent 48631e32be
commit 5c17f87f89
13 changed files with 244 additions and 177 deletions

View File

@@ -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 = [];