Очередь разбора: сумма/получатель/дата/адрес проекта, дата получения и дни; автоудаление уже проведённого; справочник проектов QuickBooks и закрытые проекты; запрос почты с Delivered-To (по встрече 2026-11-27)
All checks were successful
ci / test (push) Successful in 49s
ci / deploy (push) Successful in 2m58s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-27 18:01:37 +03:00
parent e716c82075
commit 24fed3d5a1
10 changed files with 200 additions and 20 deletions

View File

@@ -6,6 +6,7 @@ import { runFraudWeekly } from "./chargeback.js";
import { manualMessenger, runCertificates } from "./certificates.js";
import { makeClaudeRunner } from "./claude-runner.js";
import { DriveClient } from "./drive.js";
import { pruneBooked } from "./booked.js";
import { runFinalize } from "./finalize.js";
import { runFraudFlags } from "./fraud.js";
import { runInvoiceCheck } from "./invoice-check.js";
@@ -89,13 +90,18 @@ const app = buildApi({
});
return runInvoiceIngest({ pool, mail, drive, claude, now: () => new Date(), log });
},
finalize: () => runFinalize({
finalize: async () => {
// уже разнесённое в QuickBooks убираем из очереди до завершения разбора
const booked = await pruneBooked(pool);
const done = await runFinalize({
pool,
delaySeconds: s.finalizeDelaySeconds,
noReceiptLimitUsd: s.receipts.noReceiptLimitUsd,
notify,
notifyPerson: slack ? async (slackUserId, text) => void (await slack.postMessage(slackUserId, text)) : undefined,
}),
});
return booked.closed ? { ...done, booked } : done;
},
categorize: async () =>
runCategorization({
pool,