mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-30 21:49:18 +01:00
fix(server): schedule approval retention from durable source deadlines
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
f240381fd8
commit
ea3dd40cdd
27 files changed
+893
-150
No files matched your search
@@ -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 };
|
||||
|
||||
Reference in new issue
Block a user