Ночное задание spam-rescue: возврат инвойсов из Спама (слова проектов/клиентов/вендоров, белый список, фильтры Gmail), миграция 075
All checks were successful
ci / test (push) Successful in 49s
ci / deploy (push) Successful in 2m56s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-30 06:54:05 +03:00
parent 9014b5324e
commit 4ff79b2735
6 changed files with 289 additions and 1 deletions

View File

@@ -14,6 +14,7 @@ import { runInvoicePaid } from "./invoice-paid.js";
import { runInvoiceReconcile } from "./invoice-reconcile.js";
import { GmailClient } from "./gmail.js";
import { GoogleAuth } from "./google.js";
import { runSpamRescue } from "./spam-rescue.js";
import { runHistoryWeekly } from "./history-report.js";
import { makeClaudeStatementReader, runMonthlyReconcile } from "./reconcile.js";
import { buildApi } from "./http-api.js";
@@ -153,6 +154,10 @@ const app = buildApi({
},
"history-weekly": () => runHistoryWeekly({ pool, ...reportSlack() }),
"fraud-weekly": () => runFraudWeekly({ pool, ...reportSlack() }),
"spam-rescue": async () => {
if (!auth || !s.google) throw new Error("не настроены google (ключ сервисного аккаунта)");
return runSpamRescue({ pool, auth, log, mailboxes: s.google.spamRescue.mailboxes, sourceMailbox: s.google.gmailUser, dryRun: s.google.spamRescue.dryRun });
},
summary: async () => {
if (!slack || !s.slack) throw new Error("не настроен slack (botToken, accountingChannelId)");
const options = { nonWorkdays: await nonWorkdays(), mathesarUrl: s.mathesarUrl, bankFeedUrl: s.receipts.qboBankingUrl };