Q156: approval history pages back and opens each decision in full
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
41359e268a
commit
71ac5085cd
12 files changed
+243
-130
No files matched your search
@@ -3,15 +3,13 @@ import { existsSync, readFileSync } from "node:fs";
|
||||
import type { DatabaseSync } from "node:sqlite";
|
||||
import { parseApprovalPin, type ApprovalDrift, type ApprovalPin } from "../../shared/approval-pin";
|
||||
|
||||
const CHECKED_APPROVALS = 24;
|
||||
|
||||
/** Approved deliverables whose content no longer matches what was approved, read from disk and the library now. */
|
||||
export function approvalDrifts(db: DatabaseSync, orgId: string): Record<string, ApprovalDrift> {
|
||||
/** Of the given approvals (those the reader has on screen), the approved deliverables whose content no longer matches what was approved. */
|
||||
export function approvalDrifts(db: DatabaseSync, orgId: string, approvalIds: string[]): Record<string, ApprovalDrift> {
|
||||
const rows = db.prepare(`
|
||||
select id, subject_snapshot from approvals
|
||||
where org_id = ? and state = 'approved' and kind = 'deliverable_review' and subject_snapshot is not null
|
||||
order by decided_at desc limit ?
|
||||
`).all(orgId, CHECKED_APPROVALS) as Array<{ id: string; subject_snapshot: string }>;
|
||||
and id in (select value from json_each(?))
|
||||
`).all(orgId, JSON.stringify(approvalIds)) as Array<{ id: string; subject_snapshot: string }>;
|
||||
const drifts: Record<string, ApprovalDrift> = {};
|
||||
for (const row of rows) {
|
||||
const pin = parseApprovalPin(row.subject_snapshot);
|
||||
|
||||
Reference in new issue
Block a user