fix(server): schedule approval retention from durable source deadlines

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-10-24 14:43:07 -07:00
1 parent f240381fd8
commit ea3dd40cdd
27 files changed
+893 -150

No files matched your search

+3 -2
View File
@@ -1,3 +1,4 @@
import { writeApprovalChange } from "../services/retention-work-notifications.js";
import { and, eq, inArray } from "drizzle-orm";
import { approvals, type Db } from "@paperclipai/db";
import { notFound, unprocessable } from "../errors.js";
@@ -37,7 +38,7 @@ export function approvalResolutionRecords(db: Db) {
}
const now = new Date();
const updated = await database
const updated = await writeApprovalChange(database, tx => tx
.update(approvals)
.set({
status: targetStatus,
@@ -48,7 +49,7 @@ export function approvalResolutionRecords(db: Db) {
})
.where(and(eq(approvals.id, id), inArray(approvals.status, resolvableStatuses)))
.returning()
.then((rows) => rows[0] ?? null);
.then((rows) => rows[0] ?? null));
if (updated) {
return { approval: updated, applied: true };