Сервис qbo_auth: OAuth-токены QuickBooks Online (callback services/api/qbo/callback), исследование и предложение quickbooks_bookkeeper (п.84)
All checks were successful
ci / test (push) Successful in 36s
ci / deploy (push) Successful in 5m18s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-16 22:19:06 +03:00
parent 6c4767c806
commit d8926bc6dc
19 changed files with 880 additions and 1 deletions

View File

@@ -0,0 +1,20 @@
-- Подключение к QuickBooks Online (сервис qbo_auth): токены приложения и одноразовые state авторизации.
-- Токены хранятся зашифрованными (AES-256-GCM, ключ qbo_auth.encryptionKey в settings.json5), не в открытом виде.
create table if not exists qbo_connection (
environment text primary key check (environment in ('sandbox', 'production')),
realm_id text not null, -- идентификатор компании QuickBooks
access_token_enc text not null,
refresh_token_enc text not null,
access_expires_at timestamptz not null, -- access token живёт 60 минут
refresh_expires_at timestamptz not null, -- refresh token скользящий, до 100 дней
authorized_at timestamptz not null, -- когда администратор дал согласие
refreshed_at timestamptz not null,
status text not null default 'ok' check (status in ('ok', 'reauth_needed'))
);
create table if not exists qbo_oauth_state (
state text primary key,
environment text not null check (environment in ('sandbox', 'production')),
created_at timestamptz not null default now()
);
alter table qbo_connection enable row level security;
alter table qbo_oauth_state enable row level security;