Ночное задание 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

@@ -0,0 +1,21 @@
-- Ночное задание spam-rescue: письма на invoice@, попавшие в Спам, возвращаются во «Входящие»; одобренные Анастасией отправители -> белый список.
-- acc_mail_whitelist: точные адреса (не домены). filter_mailboxes - ящики, где уже создан фильтр Gmail «не отправлять в Спам».
create table if not exists acc_mail_whitelist (
email text primary key,
display_name text,
source text not null default 'manual', -- 'manual' | 'approved-invoice'
source_message_id text,
approved_by text,
note text,
filter_mailboxes text[] not null default '{}',
created_at timestamptz not null default now()
);
-- acc_mail_keywords: дополнительные слова вручную (основной список слов берётся из qbo_vendor/qbo_customer без дублирования).
create table if not exists acc_mail_keywords (
term text primary key,
kind text not null default 'other', -- 'project' | 'client' | 'vendor' | 'other'
note text,
created_at timestamptz not null default now()
);
alter table acc_mail_whitelist enable row level security;
alter table acc_mail_keywords enable row level security;