diff --git a/functions/api/inactivity/[id].ts b/functions/api/inactivity/[id].ts index f9de2db..479b8da 100644 --- a/functions/api/inactivity/[id].ts +++ b/functions/api/inactivity/[id].ts @@ -127,9 +127,9 @@ export async function onRequestPut(context: RequestContext) { "SELECT open FROM inactivity_notices WHERE id = ?;", ) .bind(context.params.id) - .run(); + .first(); - if (!Boolean(d1entry.results.at(0)?.open)) + if (!Boolean(d1entry?.open)) return jsonError("Cannot modify a closed inactivity notice", 403); const { departments, end, reason, start } = context.data.body;